Skip to content

Commit

Permalink
(feat): save boost rejection reason to the boost's entities
Browse files Browse the repository at this point in the history
  • Loading branch information
eiennohi authored and markharding committed Sep 21, 2017
1 parent 5cdfbd6 commit 92efc59
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/Groups/Entities/Group.php
Expand Up @@ -32,6 +32,7 @@ class Group extends NormalizedEntity
protected $featured_id;
protected $tags = '';
protected $owner_guids = [];
protected $boost_rejection_reason = -1;

protected $exportableDefaults = [
'guid',
Expand All @@ -45,6 +46,7 @@ class Group extends NormalizedEntity
'featured',
'featured_id',
'tags',
'boost_rejection_reason',
];

/**
Expand Down Expand Up @@ -80,6 +82,7 @@ public function save(array $opts = [])
'featured_id' => $this->featured_id,
'tags' => $this->tags,
'owner_guids' => $this->owner_guids,
'boost_rejection_reason' => $this->boost_rejection_reason,
]);

if (!$saved) {
Expand Down Expand Up @@ -454,6 +457,17 @@ public function getRequestsCount()
return Membership::_($this)->getRequestsCount();
}

public function setBoostRejectionReason($reason)
{
$this->boost_rejection_reason = (int) $reason;
return $this;
}

public function getBoostRejectionReason()
{
return $this->boost_rejection_reason;
}

/**
* Public facing properties export
* @param array $keys
Expand All @@ -470,6 +484,7 @@ public function export(array $keys = [])
//$export['requests:count'] = $this->getRequestsCount();
$export['icontime'] = $export['icon_time'];
$export['briefdescription'] = $export['brief_description'];
$export['boost_rejection_reason'] = $this->getBoostRejectionReason() ?: -1;

$userIsAdmin = Core\Session::isAdmin();

Expand Down
14 changes: 14 additions & 0 deletions plugins/blog/entities/Blog.php
Expand Up @@ -15,6 +15,7 @@ protected function initializeAttributes()

$this->attributes['subtype'] = "blog";
$this->attributes['mature'] = false;
$this->attributes['boost_rejection_reason'] = -1;
}

/**
Expand All @@ -33,6 +34,7 @@ public function getExportableValues()
'header_top',
'monetized',
'mature',
'boost_rejection_reason',
));
}

Expand Down Expand Up @@ -84,6 +86,17 @@ public function getMature()
return (bool) $this->mature;
}

public function setBoostRejectionReason($reason)
{
$this->boost_rejection_reason = (int) $reason;
return $this;
}

public function getBoostRejectionReason()
{
return (int) $this->boost_rejection_reason;
}

/**
* Return the url for this entity
*/
Expand All @@ -101,6 +114,7 @@ public function export()
$export['thumbs:up:count'] = Helpers\Counters::get($this->guid, 'thumbs:up');
$export['thumbs:down:count'] = Helpers\Counters::get($this->guid, 'thumbs:down');
$export['mature'] = (bool) $export['mature'];
$export['boost_rejection_reason'] = $this->getBoostRejectionReason();
$export['monetized'] = (bool) $export['monetized'];
return $export;
}
Expand Down

0 comments on commit 92efc59

Please sign in to comment.