Prepare for ActivityModerationPlugin

This commit is contained in:
Mikael Nordfeldth 2015-09-10 15:55:37 +02:00
parent 9ad9b91efb
commit 604ed1fd9a
3 changed files with 12 additions and 13 deletions

View File

@ -17,30 +17,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
if (!defined('STATUSNET')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
/** /**
* Table Definition for notice * Table Definition for deleted_notice
*/ */
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Deleted_notice extends Managed_DataObject class Deleted_notice extends Managed_DataObject
{ {
###START_AUTOCODE public $__table = 'deleted_notice'; // table name
/* the code below is auto generated do not remove the above tag */
public $__table = 'deleted_notice'; // table name
public $id; // int(4) primary_key not_null public $id; // int(4) primary_key not_null
public $profile_id; // int(4) not_null public $profile_id; // int(4) not_null
public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space
public $created; // datetime() not_null public $created; // datetime() not_null
public $deleted; // datetime() not_null public $deleted; // datetime() not_null
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef() public static function schemaDef()
{ {
return array( return array(

View File

@ -158,6 +158,14 @@ class Notice extends Managed_DataObject
$this->_profile[$this->profile_id] = $profile; $this->_profile[$this->profile_id] = $profile;
} }
public function deleteAs(Profile $actor)
{
if ($this->getProfile()->sameAs($actor) || $actor->hasRight(Right::DELETEOTHERSNOTICE)) {
return $this->delete();
}
throw new AuthorizationException('You are not allowed to delete other user\'s notices');
}
function delete($useWhere=false) function delete($useWhere=false)
{ {
// For auditing purposes, save a record that the notice // For auditing purposes, save a record that the notice

View File

@ -54,9 +54,9 @@ class ActivityVerb
const FRIEND = 'http://activitystrea.ms/schema/1.0/make-friend'; const FRIEND = 'http://activitystrea.ms/schema/1.0/make-friend';
const JOIN = 'http://activitystrea.ms/schema/1.0/join'; const JOIN = 'http://activitystrea.ms/schema/1.0/join';
const TAG = 'http://activitystrea.ms/schema/1.0/tag'; const TAG = 'http://activitystrea.ms/schema/1.0/tag';
const DELETE = 'delete'; // the url part is not used anymore, and this feature is new enough to avoid problems with legacy nodes if used without http://...
// Custom OStatus verbs for the flipside until they're standardized // Custom OStatus verbs for the flipside until they're standardized
const DELETE = 'http://ostatus.org/schema/1.0/unfollow';
const UNFAVORITE = 'http://activitystrea.ms/schema/1.0/unfavorite'; const UNFAVORITE = 'http://activitystrea.ms/schema/1.0/unfavorite';
const UNLIKE = 'http://activitystrea.ms/schema/1.0/unlike'; // This is a synonym of unfavorite const UNLIKE = 'http://activitystrea.ms/schema/1.0/unlike'; // This is a synonym of unfavorite
const UNFOLLOW = 'http://ostatus.org/schema/1.0/unfollow'; const UNFOLLOW = 'http://ostatus.org/schema/1.0/unfollow';