diff --git a/actions/showstream.php b/actions/showstream.php index eb6300fec2..8dd6c7deff 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -225,10 +225,7 @@ class ShowstreamAction extends ProfileAction function showNotices() { - $pnl = null; - if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) { - $pnl = new ProfileNoticeList($this->notice, $this); - } + $pnl = new NoticeList($this->notice, $this); $cnt = $pnl->show(); if (0 == $cnt) { $this->showEmptyListMessage(); diff --git a/lib/default.php b/lib/default.php index 8b15d57857..e9382a86bc 100644 --- a/lib/default.php +++ b/lib/default.php @@ -302,6 +302,7 @@ $default = 'AuthCrypt' => array(), 'Cronish' => array(), 'Favorite' => array(), + 'Share' => array(), 'LRDD' => array(), 'StrictTransportSecurity' => array(), ), diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php index 9c2f2ed406..bb1eb17eb3 100644 --- a/lib/noticelistitem.php +++ b/lib/noticelistitem.php @@ -193,7 +193,6 @@ class NoticeListItem extends Widget $this->out->elementStart('div', 'notice-options'); if (Event::handle('StartShowNoticeOptionItems', array($this))) { $this->showReplyLink(); - $this->showRepeatForm(); $this->showDeleteLink(); Event::handle('EndShowNoticeOptionItems', array($this)); } @@ -605,34 +604,6 @@ class NoticeListItem extends Widget } } - /** - * show the form to repeat a notice - * - * @return void - */ - function showRepeatForm() - { - if ($this->notice->scope == Notice::PUBLIC_SCOPE || - $this->notice->scope == Notice::SITE_SCOPE) { - $user = common_current_user(); - if (!empty($user) && - $user->id != $this->notice->profile_id) { - $this->out->text(' '); - $profile = $user->getProfile(); - if ($profile->hasRepeated($this->notice)) { - $this->out->element('span', array('class' => 'repeated', - // TRANS: Title for repeat form status in notice list when a notice has been repeated. - 'title' => _('Notice repeated.')), - // TRANS: Repeat form status in notice list when a notice has been repeated. - _('Repeated')); - } else { - $rf = new RepeatForm($this->out, $this->notice); - $rf->show(); - } - } - } - } - /** * finish the notice * diff --git a/lib/profilenoticelist.php b/lib/profilenoticelist.php deleted file mode 100644 index d95709e7e9..0000000000 --- a/lib/profilenoticelist.php +++ /dev/null @@ -1,11 +0,0 @@ -out); - } -} diff --git a/lib/profilenoticelistitem.php b/lib/profilenoticelistitem.php deleted file mode 100644 index d7773cab31..0000000000 --- a/lib/profilenoticelistitem.php +++ /dev/null @@ -1,49 +0,0 @@ -repeat)) { - - // FIXME: this code is almost identical to default; need to refactor - - $attrs = array('href' => $this->profile->profileurl, - 'class' => 'url'); - - if (!empty($this->profile->fullname)) { - $attrs['title'] = $this->profile->getFancyName(); - } - - $this->out->elementStart('span', 'repeat'); - - $text_link = XMLStringer::estring('a', $attrs, $this->profile->nickname); - - // TRANS: Link to the author of a repeated notice. %s is a linked nickname. - $this->out->raw(sprintf(_('Repeat of %s'), $text_link)); - - $this->out->elementEnd('span'); - } - } -} diff --git a/plugins/GNUsocialProfileExtensions/GNUsocialProfileExtensionsPlugin.php b/plugins/GNUsocialProfileExtensions/GNUsocialProfileExtensionsPlugin.php index 6b3c757b1e..c4628c4ecc 100644 --- a/plugins/GNUsocialProfileExtensions/GNUsocialProfileExtensionsPlugin.php +++ b/plugins/GNUsocialProfileExtensions/GNUsocialProfileExtensionsPlugin.php @@ -137,21 +137,4 @@ class GNUsocialProfileExtensionsPlugin extends Plugin array('nickname' => $nav->action->trimmed('nickname'))), _('Bio'), _('The user\'s extended profile'), $nav->action->trimmed('action') == 'bio', 'nav_bio'); } - - //Why the heck is this shoved into this plugin!?!? It deserves its own! - function onShowStreamNoticeList($notice, $action, &$pnl) - { - //TODO: This function is called after the notices in $notice are superfluously retrieved in showstream.php - $newnotice = new Notice(); - $newnotice->profile_id = $action->user->id; - $newnotice->orderBy('modified DESC'); - $newnotice->whereAdd('reply_to IS NULL'); - $newnotice->limit(($action->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); - $newnotice->find(); - - $pnl = new NoticeTree($newnotice, $action); - return false; - } - } - diff --git a/plugins/ModPlus/actions/remoteprofile.php b/plugins/ModPlus/actions/remoteprofile.php index 133646480c..4203672030 100644 --- a/plugins/ModPlus/actions/remoteprofile.php +++ b/plugins/ModPlus/actions/remoteprofile.php @@ -39,10 +39,7 @@ class RemoteProfileAction extends ShowstreamAction $this->raw(common_markup_to_html($markdown)); }else{ - $pnl = null; - if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) { - $pnl = new ProfileNoticeList($this->notice, $this); - } + $pnl = new NoticeList($this->notice, $this); $cnt = $pnl->show(); if (0 == $cnt) { $this->showEmptyListMessage(); diff --git a/plugins/Share/SharePlugin.php b/plugins/Share/SharePlugin.php index 18143d5a63..0a974701c0 100644 --- a/plugins/Share/SharePlugin.php +++ b/plugins/Share/SharePlugin.php @@ -161,22 +161,16 @@ class SharePlugin extends ActivityVerbHandlerPlugin // ActivityObject is instead turned into an Activity $object = new Activity(); $object->verb = ActivityVerb::SHARE; - $object->type = $notice->object_type; - $object->title = sprintf(_('%1$s repeated a notice by %2$s'), - $object->getProfile()->getNickname(), - $target->getProfile()->getNickname()); $object->content = $notice->rendered; + $this->extendActivity($stored, $act); + return $object; } public function deleteRelated(Notice $notice) { - try { - $fave = Fave::fromStored($notice); - $fave->delete(); - } catch (NoResultException $e) { - // Cool, no problem. We wanted to get rid of it anyway. - } + // No action needed as we don't have a separate table for share objects. + return true; } // API stuff @@ -260,20 +254,26 @@ class SharePlugin extends ActivityVerbHandlerPlugin * * @return void */ - public function onStartShowNoticeOptionItems($nli) + public function onEndShowNoticeOptionItems($nli) { - if (Event::handle('StartShowFaveForm', array($nli))) { + // FIXME: Use bitmasks (but be aware that PUBLIC_SCOPE is 0!) + if ($nli->notice->scope == Notice::PUBLIC_SCOPE || + $nli->notice->scope == Notice::SITE_SCOPE) { $scoped = Profile::current(); - if ($scoped instanceof Profile) { - if (Fave::existsForProfile($nli->notice, $scoped)) { - $disfavor = new DisfavorForm($nli->out, $nli->notice); - $disfavor->show(); + if ($scoped instanceof Profile && + $scoped->getID() !== $nli->notice->getProfile()->getID()) { + + if ($scoped->hasRepeated($nli->notice)) { + $nli->out->element('span', array('class' => 'repeated', + // TRANS: Title for repeat form status in notice list when a notice has been repeated. + 'title' => _('Notice repeated.')), + // TRANS: Repeat form status in notice list when a notice has been repeated. + _('Repeated')); } else { - $favor = new FavorForm($nli->out, $nli->notice); - $favor->show(); + $repeat = new RepeatForm($nli->out, $nli->notice); + $repeat->show(); } } - Event::handle('EndShowFaveForm', array($nli)); } } diff --git a/lib/repeatform.php b/plugins/Share/forms/repeat.php similarity index 100% rename from lib/repeatform.php rename to plugins/Share/forms/repeat.php