Browse Source

reset reply context state when URL is removed

pull/64/head
Aaron Parecki 8 years ago
parent
commit
40bc510cb7
No known key found for this signature in database GPG Key ID: 276C2817346D6056
  1. 4
      controllers/controllers.php
  2. 8
      views/new-post.php

4
controllers/controllers.php

@ -397,6 +397,10 @@ $app->get('/reply/preview', function() use($app) {
if($user=require_login($app)) { if($user=require_login($app)) {
$params = $app->request()->params(); $params = $app->request()->params();
if(!isset($params['url']) || !$params['url']) {
return '';
}
$reply_url = trim($params['url']); $reply_url = trim($params['url']);
if(preg_match('/twtr\.io\/([0-9a-z]+)/i', $reply_url, $match)) { if(preg_match('/twtr\.io\/([0-9a-z]+)/i', $reply_url, $match)) {

8
views/new-post.php

@ -310,6 +310,14 @@ $(function(){
$("#note_in_reply_to").on('change', function(){ $("#note_in_reply_to").on('change', function(){
var reply_to = $("#note_in_reply_to").val(); 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"); $(".reply-section .loading").removeClass("hidden");
$.get("/reply/preview", {url:reply_to}, function(data){ $.get("/reply/preview", {url:reply_to}, function(data){

Loading…
Cancel
Save