Consistently send Profiles into Fave::addNew()
This commit is contained in:
parent
2d79455a1f
commit
533a3bf6a3
|
@ -123,7 +123,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fave = Fave::addNew($this->user, $this->notice);
|
$fave = Fave::addNew($this->user->getProfile(), $this->notice);
|
||||||
|
|
||||||
if (empty($fave)) {
|
if (empty($fave)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
|
|
@ -21,7 +21,15 @@ class Fave extends Memcached_DataObject
|
||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
static function addNew($profile, $notice) {
|
/**
|
||||||
|
* Save a favorite record.
|
||||||
|
* @fixme post-author notification should be moved here
|
||||||
|
*
|
||||||
|
* @param Profile $profile the local or remote user who likes
|
||||||
|
* @param Notice $notice the notice that is liked
|
||||||
|
* @return mixed false on failure, or Fave record on success
|
||||||
|
*/
|
||||||
|
static function addNew(Profile $profile, Notice $notice) {
|
||||||
|
|
||||||
$fave = null;
|
$fave = null;
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ class FavCommand extends Command
|
||||||
function handle($channel)
|
function handle($channel)
|
||||||
{
|
{
|
||||||
$notice = $this->getNotice($this->other);
|
$notice = $this->getNotice($this->other);
|
||||||
$fave = Fave::addNew($this->user, $notice);
|
$fave = Fave::addNew($this->user->getProfile(), $notice);
|
||||||
|
|
||||||
if (!$fave) {
|
if (!$fave) {
|
||||||
$channel->error($this->user, _('Could not create favorite.'));
|
$channel->error($this->user, _('Could not create favorite.'));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user