From f2e3021b59f3661b3c900b06600a580b8970df2f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 20 Oct 2008 13:02:45 -0400 Subject: try to make replies point to the clicked-on notice darcs-hash:20081020170245-5ed1f-b84f63d9d9b589bd18f97924db547e348beb6647.gz --- actions/newnotice.php | 4 +++- js/util.js | 5 ++++- lib/stream.php | 2 +- lib/util.php | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/actions/newnotice.php b/actions/newnotice.php index e80c03031..ac630eed0 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -58,8 +58,10 @@ class NewnoticeAction extends Action { $cmd->execute(new WebChannel()); return; } + + $replyto = $this->trimmed('inreplyto'); - $notice = Notice::saveNew($user->id, $content, 'web'); + $notice = Notice::saveNew($user->id, $content, 'web', $replyto); if (is_string($notice)) { $this->show_form($notice); diff --git a/js/util.js b/js/util.js index fe3ed74dc..0055c35df 100644 --- a/js/util.js +++ b/js/util.js @@ -88,7 +88,7 @@ $(document).ready(function(){ $("form.disfavor").each(addAjaxHidden); }); -function doreply(nick) { +function doreply(nick,id) { rgx_username = /^[0-9a-zA-Z\-_.]*$/; if (nick.match(rgx_username)) { replyto = "@" + nick + " "; @@ -97,6 +97,9 @@ function doreply(nick) { $("#status_textarea").focus(); return false; } + if (id) { + $("#inreplyto").val(id); + } } return true; } diff --git a/lib/stream.php b/lib/stream.php index 8a2c1e9b0..ea452096c 100644 --- a/lib/stream.php +++ b/lib/stream.php @@ -87,7 +87,7 @@ class StreamAction extends PersonalAction { common_element_start('a', array('href' => common_local_url('newnotice', array('replyto' => $profile->nickname)), - 'onclick' => 'return doreply("'.$profile->nickname.'");', + 'onclick' => 'return doreply("'.$profile->nickname.'", '.$notice->id.');', 'title' => _('reply'), 'class' => 'replybutton')); common_raw('→'); diff --git a/lib/util.php b/lib/util.php index bb5da1396..6e9e4533c 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1298,6 +1298,8 @@ function common_notice_form($action=NULL, $content=NULL) { if ($action) { common_hidden('returnto', $action); } + # set by JavaScript + common_hidden('inreplyto', 'false'); common_element('input', array('id' => 'status_submit', 'name' => 'status_submit', 'type' => 'submit', -- cgit v1.2.3-54-g00ecf