Merge branch 'master' into 0.9.x
This commit is contained in:
commit
5519da95fd
@ -186,6 +186,10 @@ class Profile extends Memcached_DataObject
|
|||||||
$notice = $this->getNotices(0, 1);
|
$notice = $this->getNotices(0, 1);
|
||||||
|
|
||||||
if ($notice->fetch()) {
|
if ($notice->fetch()) {
|
||||||
|
if ($notice instanceof ArrayWrapper) {
|
||||||
|
// hack for things trying to work with single notices
|
||||||
|
return $notice->_items[0];
|
||||||
|
}
|
||||||
return $notice;
|
return $notice;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -287,6 +287,18 @@ class FavCommand extends Command
|
|||||||
function handle($channel)
|
function handle($channel)
|
||||||
{
|
{
|
||||||
$notice = $this->getNotice($this->other);
|
$notice = $this->getNotice($this->other);
|
||||||
|
|
||||||
|
$fave = new Fave();
|
||||||
|
$fave->user_id = $this->user->id;
|
||||||
|
$fave->notice_id = $notice->id;
|
||||||
|
$fave->find();
|
||||||
|
|
||||||
|
if ($fave->fetch()) {
|
||||||
|
// TRANS: Error message text shown when a favorite could not be set because it has already been favorited.
|
||||||
|
$channel->error($this->user, _('Could not create favorite: already favorited.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$fave = Fave::addNew($this->user->getProfile(), $notice);
|
$fave = Fave::addNew($this->user->getProfile(), $notice);
|
||||||
|
|
||||||
if (!$fave) {
|
if (!$fave) {
|
||||||
@ -300,7 +312,7 @@ class FavCommand extends Command
|
|||||||
|
|
||||||
$other = User::staticGet('id', $notice->profile_id);
|
$other = User::staticGet('id', $notice->profile_id);
|
||||||
|
|
||||||
if ($other && $other->id != $user->id) {
|
if ($other && $other->id != $this->user->id) {
|
||||||
if ($other->email && $other->emailnotifyfav) {
|
if ($other->email && $other->emailnotifyfav) {
|
||||||
mail_notify_fave($other, $this->user, $notice);
|
mail_notify_fave($other, $this->user, $notice);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user