Some changes for better code quality

This commit is contained in:
Michael 2018-09-30 07:21:57 +00:00
parent b043c7e0f2
commit 82987d018a
7 changed files with 17 additions and 23 deletions

View file

@ -1081,9 +1081,8 @@ class Item extends BaseObject
DBA::delete('item-delivery-data', ['iid' => $item['id']]);
//if (!empty($item['iaid']) && !self::exists(['iaid' => $item['iaid'], 'deleted' => false])) {
// DBA::delete('item-activity', ['id' => $item['iaid']], ['cascade' => false]);
//}
// We don't delete the item-activity here, since we need some of the data for ActivityPub
if (!empty($item['icid']) && !self::exists(['icid' => $item['icid'], 'deleted' => false])) {
DBA::delete('item-content', ['id' => $item['icid']], ['cascade' => false]);
}

View file

@ -35,7 +35,7 @@ class Profile
*
* @return array Profile data
*/
public static function getProfileForUser($uid)
public static function getByUID($uid)
{
$profile = DBA::selectFirst('profile', [], ['uid' => $uid, 'is-default' => true]);
return $profile;

View file

@ -33,9 +33,9 @@ class Term
return $tag_text;
}
public static function tagArrayFromItemId($itemid)
public static function tagArrayFromItemId($itemid, $type = [TERM_HASHTAG, TERM_MENTION])
{
$condition = ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]];
$condition = ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => $type];
$tags = DBA::select('term', ['type', 'term', 'url'], $condition);
if (!DBA::isResult($tags)) {
return [];