Found some unreachable code in Favorite

The portion after StartAtomPubNewActivity would never be reached since
Favorite handles that activity through ActivityHandlerPlugin nowadays.
So I cleaned it up and followed a couple of paths, making stuff prettier.
This commit is contained in:
Mikael Nordfeldth
2015-01-12 02:23:23 +01:00
parent 73669ed308
commit aca5ff1b23
5 changed files with 38 additions and 123 deletions

View File

@@ -44,7 +44,8 @@ class Fave extends Managed_DataObject
*
* @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
* @return Fave record on success
* @throws Exception on failure
*/
static function addNew(Profile $profile, Notice $notice) {
@@ -66,7 +67,7 @@ class Fave extends Managed_DataObject
$fave->insert();
} catch (ServerException $e) {
common_log_db_error($fave, 'INSERT', __FILE__);
return false;
throw $e;
}
self::blowCacheForProfileId($fave->user_id);
self::blowCacheForNoticeId($fave->notice_id);
@@ -158,7 +159,7 @@ class Fave extends Managed_DataObject
return $act;
}
static function existsForProfile($notice, Profile $scoped)
static function existsForProfile(Notice $notice, Profile $scoped)
{
$fave = self::pkeyGet(array('user_id'=>$scoped->id, 'notice_id'=>$notice->id));