diff --git a/controllers/controllers.php b/controllers/controllers.php index a9bc0ab..889c08a 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -397,6 +397,10 @@ $app->get('/reply/preview', function() use($app) { if($user=require_login($app)) { $params = $app->request()->params(); + if(!isset($params['url']) || !$params['url']) { + return ''; + } + $reply_url = trim($params['url']); if(preg_match('/twtr\.io\/([0-9a-z]+)/i', $reply_url, $match)) { diff --git a/views/new-post.php b/views/new-post.php index 68460d0..d75d6b4 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -310,6 +310,14 @@ $(function(){ $("#note_in_reply_to").on('change', function(){ var reply_to = $("#note_in_reply_to").val(); + + if(reply_to == "") { + $(".reply-section").addClass("hidden"); + $(".reply-context").addClass("hidden"); + $("#expand-reply").removeClass("hidden"); + return; + } + $(".reply-section .loading").removeClass("hidden"); $.get("/reply/preview", {url:reply_to}, function(data){