public static function canDelete($activity)
{
$session = Gdn::session();
$profileUserId = val('ActivityUserID', $activity);
$notifyUserId = val('NotifyUserID', $activity);
// User can delete any activity
if ($session->checkPermission('Garden.Activity.Delete')) {
return true;
}
$notifyUserIds = [ActivityModel::NOTIFY_PUBLIC];
if (Gdn::session()->checkPermission('Garden.Moderation.Manage')) {
$notifyUserIds[] = ActivityModel::NOTIFY_MODS;
}
// Is this a wall post?
if (!in_array(val('ActivityType', $activity), ['Status', 'WallPost']) || !in_array($notifyUserId, $notifyUserIds)) {
return false;
}
// Is this on the user's wall?
if ($profileUserId && $session->UserID == $profileUserId && $session->checkPermission('Garden.Profiles.Edit')) {
return true;
}
// The user inserted the activity --- may be added in later
// $insertUserId = val('InsertUserID', $activity);
// if ($insertUserId && $insertUserId == $session->UserID) {
// return true;
// }
return false;
}