From: Evan Prodromou Date: Wed, 24 Aug 2011 21:17:03 +0000 (-0400) Subject: hide buttons for repeat, delete system activities X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3d831ebcfba6ea8f5f1a19f4f78d986e73462183;p=quix0rs-gnu-social.git hide buttons for repeat, delete system activities --- diff --git a/plugins/Activity/ActivityPlugin.php b/plugins/Activity/ActivityPlugin.php index e3ee39dc9a..0423a791e4 100644 --- a/plugins/Activity/ActivityPlugin.php +++ b/plugins/Activity/ActivityPlugin.php @@ -67,6 +67,7 @@ class ActivityPlugin extends Plugin case 'LeaveListItem': case 'FollowListItem': case 'UnfollowListItem': + case 'SystemListItem': include_once $dir . '/'.strtolower($cls).'.php'; return false; default: diff --git a/plugins/Activity/followlistitem.php b/plugins/Activity/followlistitem.php index 5a3721013a..ddbbc45cc0 100644 --- a/plugins/Activity/followlistitem.php +++ b/plugins/Activity/followlistitem.php @@ -45,34 +45,7 @@ if (!defined('STATUSNET')) { * @link http://status.net/ */ -class FollowListItem extends NoticeListItemAdapter +class FollowListItem extends SystemListItem { - /** - * Show the join activity - * - * @return void - */ - - function showNotice() - { - $out = $this->nli->out; - $out->elementStart('div', 'entry-title'); - $this->showContent(); - $out->elementEnd('div'); - } - - function showContent() - { - $notice = $this->nli->notice; - $out = $this->nli->out; - - // FIXME: get the actual data on the leave - - $out->elementStart('div', 'follow-activity'); - - $out->raw($notice->rendered); - - $out->elementEnd('div'); - } } diff --git a/plugins/Activity/joinlistitem.php b/plugins/Activity/joinlistitem.php index 29774917ac..1979524001 100644 --- a/plugins/Activity/joinlistitem.php +++ b/plugins/Activity/joinlistitem.php @@ -3,7 +3,7 @@ * StatusNet - the distributed open-source microblogging tool * Copyright (C) 2011, StatusNet, Inc. * - * Title of module + * List item for when you join a group * * PHP version 5 * @@ -45,22 +45,8 @@ if (!defined('STATUSNET')) { * @link http://status.net/ */ -class JoinListItem extends NoticeListItemAdapter +class JoinListItem extends SystemListItem { - /** - * Show the join activity - * - * @return void - */ - - function showNotice() - { - $out = $this->nli->out; - $out->elementStart('div', 'entry-title'); - $this->showContent(); - $out->elementEnd('div'); - } - function showContent() { $notice = $this->nli->notice; @@ -68,9 +54,8 @@ class JoinListItem extends NoticeListItemAdapter $mem = Group_member::staticGet('uri', $notice->uri); - $out->elementStart('div', 'join-activity'); - if (!empty($mem)) { + $out->elementStart('div', 'join-activity'); $profile = $mem->getMember(); $group = $mem->getGroup(); $out->raw(sprintf(_m('%s joined the group %s.'), @@ -78,11 +63,11 @@ class JoinListItem extends NoticeListItemAdapter $profile->getBestName(), $group->homeUrl(), $group->getBestName())); + + $out->elementEnd('div'); } else { - $out->raw($entry->summary); + parent::showContent(); } - - $out->elementEnd('div'); } } diff --git a/plugins/Activity/leavelistitem.php b/plugins/Activity/leavelistitem.php index 2c8565e986..64845f9018 100644 --- a/plugins/Activity/leavelistitem.php +++ b/plugins/Activity/leavelistitem.php @@ -3,7 +3,7 @@ * StatusNet - the distributed open-source microblogging tool * Copyright (C) 2011, StatusNet, Inc. * - * Title of module + * List item for when you leave a group * * PHP version 5 * @@ -35,7 +35,7 @@ if (!defined('STATUSNET')) { } /** - * NoticeListItemAdapter for join activities + * NoticeListItemAdapter for leave activities * * @category General * @package StatusNet @@ -45,34 +45,7 @@ if (!defined('STATUSNET')) { * @link http://status.net/ */ -class LeaveListItem extends NoticeListItemAdapter +class LeaveListItem extends SystemListItem { - /** - * Show the join activity - * - * @return void - */ - - function showNotice() - { - $out = $this->nli->out; - $out->elementStart('div', 'entry-title'); - $this->showContent(); - $out->elementEnd('div'); - } - - function showContent() - { - $notice = $this->nli->notice; - $out = $this->nli->out; - - // FIXME: get the actual data on the leave - - $out->elementStart('div', 'leave-activity'); - - $out->raw($notice->rendered); - - $out->elementEnd('div'); - } } diff --git a/plugins/Activity/systemlistitem.php b/plugins/Activity/systemlistitem.php new file mode 100644 index 0000000000..257f580ead --- /dev/null +++ b/plugins/Activity/systemlistitem.php @@ -0,0 +1,91 @@ +. + * + * @category Activity + * @package StatusNet + * @author Evan Prodromou + * @copyright 2011 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * NoticeListItemAdapter for system activities + * + * @category General + * @package StatusNet + * @author Evan Prodromou + * @copyright 2011 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +abstract class SystemListItem extends NoticeListItemAdapter +{ + /** + * Show the activity + * + * @return void + */ + + function showNotice() + { + $out = $this->nli->out; + $out->elementStart('div', 'entry-title'); + $this->showContent(); + $out->elementEnd('div'); + } + + function showContent() + { + $notice = $this->nli->notice; + $out = $this->nli->out; + + // FIXME: get the actual data on the leave + + $out->elementStart('div', 'system-activity'); + + $out->raw($notice->rendered); + + $out->elementEnd('div'); + } + + function showNoticeOptions() + { + if (Event::handle('StartShowNoticeOptions', array($this))) { + $user = common_current_user(); + if (!empty($user)) { + $this->nli->out->elementStart('div', 'notice-options'); + $this->showFaveForm(); + $this->showReplyLink(); + $this->nli->out->elementEnd('div'); + } + Event::handle('EndShowNoticeOptions', array($this)); + } + } +} diff --git a/plugins/Activity/unfollowlistitem.php b/plugins/Activity/unfollowlistitem.php index 8bc464ed23..b8c0d670fa 100644 --- a/plugins/Activity/unfollowlistitem.php +++ b/plugins/Activity/unfollowlistitem.php @@ -3,7 +3,7 @@ * StatusNet - the distributed open-source microblogging tool * Copyright (C) 2011, StatusNet, Inc. * - * Title of module + * Unfollow list item * * PHP version 5 * @@ -20,7 +20,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * - * @category Cache + * @category Activity * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. @@ -45,7 +45,7 @@ if (!defined('STATUSNET')) { * @link http://status.net/ */ -class UnfollowListItem extends NoticeListItemAdapter +class UnfollowListItem extends SystemListItem { /** * Show the join activity