This commit is contained in:
Hannes Mannerheim 2015-07-12 13:27:45 +02:00
parent 77f1b9d374
commit f465a8aea7

View File

@ -744,26 +744,38 @@ class QvitterPlugin extends Plugin {
// outputs an activity notice that this notice was deleted // outputs an activity notice that this notice was deleted
$profile = $notice->getProfile(); $profile = $notice->getProfile();
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> deleted notice <a href="%3$s">{{%4$s}}</a>.'),
$profile->getUrl(), // don't delete if this is a user is being deleted
$profile->getBestName(), // because that creates an infinite loop of deleting and creating notices...
$notice->getUrl(), $user_is_deleted = false;
$notice->uri); $user = User::getKV('id',$profile->id);
$text = sprintf(_m('%1$s deleted notice {{%2$s}}.'), if($user instanceof User && $user->hasRole(Profile_role::DELETED)) {
$profile->getBestName(), $user_is_deleted = true;
$notice->uri); }
$uri = TagURI::mint('delete-notice:%d:%d:%s',
$notice->profile_id, if(!$user_is_deleted) {
$notice->id, $rendered = sprintf(_m('<a href="%1$s">%2$s</a> deleted notice <a href="%3$s">{{%4$s}}</a>.'),
common_date_iso8601(common_sql_now())); $profile->getUrl(),
$notice = Notice::saveNew($notice->profile_id, $profile->getBestName(),
$text, $notice->getUrl(),
ActivityPlugin::SOURCE, $notice->uri);
array('rendered' => $rendered, $text = sprintf(_m('%1$s deleted notice {{%2$s}}.'),
'urls' => array(), $profile->getBestName(),
'uri' => $uri, $notice->uri);
'verb' => 'qvitter-delete-notice', $uri = TagURI::mint('delete-notice:%d:%d:%s',
'object_type' => ActivityObject::ACTIVITY)); $notice->profile_id,
$notice->id,
common_date_iso8601(common_sql_now()));
$notice = Notice::saveNew($notice->profile_id,
$text,
ActivityPlugin::SOURCE,
array('rendered' => $rendered,
'urls' => array(),
'uri' => $uri,
'verb' => 'qvitter-delete-notice',
'object_type' => ActivityObject::ACTIVITY));
}
return true; return true;
} }