From 57feeb566a0cb2c544545dbfc616437cae69b923 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 11 Sep 2009 22:37:37 -0400 Subject: Add a parameter named 'inreplyto' to the 'notice/new' page, so urls can inclue 'inreplyto' id's. Also add 'inreplyto' to the urls sent in emails. --- actions/newnotice.php | 3 ++- lib/mail.php | 2 +- lib/noticeform.php | 11 +++++++++-- lib/noticelist.php | 2 +- lib/router.php | 4 ++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/actions/newnotice.php b/actions/newnotice.php index 00a822860..6e3720e09 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -431,13 +431,14 @@ class NewnoticeAction extends Action $content = $this->trimmed('status_textarea'); if (!$content) { $replyto = $this->trimmed('replyto'); + $inreplyto = $this->trimmed('inreplyto'); $profile = Profile::staticGet('nickname', $replyto); if ($profile) { $content = '@' . $profile->nickname . ' '; } } - $notice_form = new NoticeForm($this, '', $content); + $notice_form = new NoticeForm($this, '', $content, null, $inreplyto); $notice_form->show(); } diff --git a/lib/mail.php b/lib/mail.php index df585406c..432b7b329 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -629,7 +629,7 @@ function mail_notify_attn($user, $notice) $notice->content,//%4 $conversationUrl,//%5 common_local_url('newnotice', - array('replyto' => $sender->nickname)),//%6 + array('replyto' => $sender->nickname, 'inreplyto' => $notice->id)),//%6 common_local_url('replies', array('nickname' => $user->nickname)),//%7 common_local_url('emailsettings'));//%8 diff --git a/lib/noticeform.php b/lib/noticeform.php index 1e3a45142..d1387b1b7 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -69,6 +69,12 @@ class NoticeForm extends Form var $user = null; + /** + * The notice being replied to + */ + + var $inreplyto = null; + /** * Constructor * @@ -77,12 +83,13 @@ class NoticeForm extends Form * @param string $content content to pre-fill */ - function __construct($out=null, $action=null, $content=null, $user=null) + function __construct($out=null, $action=null, $content=null, $user=null, $inreplyto) { parent::__construct($out); $this->action = $action; $this->content = $content; + $this->inreplyto = $inreplyto; if ($user) { $this->user = $user; @@ -161,7 +168,7 @@ class NoticeForm extends Form if ($this->action) { $this->out->hidden('notice_return-to', $this->action, 'returnto'); } - $this->out->hidden('notice_in-reply-to', $this->action, 'inreplyto'); + $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto'); } /** diff --git a/lib/noticelist.php b/lib/noticelist.php index ec85e4a5c..6b2bccd97 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -442,7 +442,7 @@ class NoticeListItem extends Widget { if (common_logged_in()) { $reply_url = common_local_url('newnotice', - array('replyto' => $this->profile->nickname)); + array('replyto' => $this->profile->nickname, 'inreplyto' => $this->notice->id)); $this->out->elementStart('a', array('href' => $reply_url, 'class' => 'notice_reply', 'title' => _('Reply to this notice'))); diff --git a/lib/router.php b/lib/router.php index 00e728f55..0505c9942 100644 --- a/lib/router.php +++ b/lib/router.php @@ -175,6 +175,10 @@ class Router $m->connect('notice/new?replyto=:replyto', array('action' => 'newnotice'), array('replyto' => '[A-Za-z0-9_-]+')); + $m->connect('notice/new?replyto=:replyto&inreplyto=:inreplyto', + array('action' => 'newnotice'), + array('replyto' => '[A-Za-z0-9_-]+'), + array('inreplyto' => '[0-9]+')); $m->connect('notice/:notice/file', array('action' => 'file'), -- cgit v1.2.3-54-g00ecf