Changes:
- unified class import, we had these both: ```` use Friendica\Model\Item as ModelItem; use Friendica\Object\Post as PostObject; ```` In first version the namespace was prefixing class name, in second suffixing it.
This commit is contained in:
parent
da66730e4f
commit
8f92d1cc8e
|
@ -36,7 +36,7 @@ use Friendica\Core\Session;
|
||||||
use Friendica\Core\Theme;
|
use Friendica\Core\Theme;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item as ItemModel;
|
||||||
use Friendica\Model\Post;
|
use Friendica\Model\Post;
|
||||||
use Friendica\Model\Tag;
|
use Friendica\Model\Tag;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
@ -135,7 +135,7 @@ class Conversation
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($activity['verb']) && $this->activity->match($activity['verb'], $verb) && ($activity['gravity'] != Item::GRAVITY_PARENT)) {
|
if (!empty($activity['verb']) && $this->activity->match($activity['verb'], $verb) && ($activity['gravity'] != ItemModel::GRAVITY_PARENT)) {
|
||||||
$author = [
|
$author = [
|
||||||
'uid' => 0,
|
'uid' => 0,
|
||||||
'id' => $activity['author-id'],
|
'id' => $activity['author-id'],
|
||||||
|
@ -755,7 +755,7 @@ class Conversation
|
||||||
|
|
||||||
$item['pagedrop'] = $page_dropping;
|
$item['pagedrop'] = $page_dropping;
|
||||||
|
|
||||||
if ($item['gravity'] == Item::GRAVITY_PARENT) {
|
if ($item['gravity'] == ItemModel::GRAVITY_PARENT) {
|
||||||
$item_object = new PostObject($item);
|
$item_object = new PostObject($item);
|
||||||
$conv->addParent($item_object);
|
$conv->addParent($item_object);
|
||||||
}
|
}
|
||||||
|
@ -825,7 +825,7 @@ class Conversation
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($activity)) {
|
if (!empty($activity)) {
|
||||||
if (($row['gravity'] == Item::GRAVITY_PARENT)) {
|
if (($row['gravity'] == ItemModel::GRAVITY_PARENT)) {
|
||||||
$row['post-reason'] = Item::PR_ANNOUNCEMENT;
|
$row['post-reason'] = Item::PR_ANNOUNCEMENT;
|
||||||
|
|
||||||
$row = array_merge($row, $activity);
|
$row = array_merge($row, $activity);
|
||||||
|
@ -834,7 +834,7 @@ class Conversation
|
||||||
$row['causer-link'] = $contact['url'];
|
$row['causer-link'] = $contact['url'];
|
||||||
$row['causer-avatar'] = $contact['thumb'];
|
$row['causer-avatar'] = $contact['thumb'];
|
||||||
$row['causer-name'] = $contact['name'];
|
$row['causer-name'] = $contact['name'];
|
||||||
} elseif (($row['gravity'] == Item::GRAVITY_ACTIVITY) && ($row['verb'] == Activity::ANNOUNCE) &&
|
} elseif (($row['gravity'] == ItemModel::GRAVITY_ACTIVITY) && ($row['verb'] == Activity::ANNOUNCE) &&
|
||||||
($row['author-id'] == $activity['causer-id'])) {
|
($row['author-id'] == $activity['causer-id'])) {
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
@ -867,7 +867,7 @@ class Conversation
|
||||||
$row['owner-name'] = $row['causer-name'];
|
$row['owner-name'] = $row['causer-name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($row['gravity'], [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT]) && !empty($row['causer-id'])) {
|
if (in_array($row['gravity'], [ItemModel::GRAVITY_PARENT, ItemModel::GRAVITY_COMMENT]) && !empty($row['causer-id'])) {
|
||||||
$causer = ['uid' => 0, 'id' => $row['causer-id'], 'network' => $row['causer-network'], 'url' => $row['causer-link']];
|
$causer = ['uid' => 0, 'id' => $row['causer-id'], 'network' => $row['causer-network'], 'url' => $row['causer-link']];
|
||||||
|
|
||||||
$row['reshared'] = $this->l10n->t('%s reshared this.', '<a href="'. htmlentities(Contact::magicLinkByContact($causer)) .'">' . htmlentities($row['causer-name']) . '</a>');
|
$row['reshared'] = $this->l10n->t('%s reshared this.', '<a href="'. htmlentities(Contact::magicLinkByContact($causer)) .'">' . htmlentities($row['causer-name']) . '</a>');
|
||||||
|
@ -941,7 +941,7 @@ class Conversation
|
||||||
$activitycounter = [];
|
$activitycounter = [];
|
||||||
|
|
||||||
foreach ($parents as $parent) {
|
foreach ($parents as $parent) {
|
||||||
if (!empty($parent['thr-parent-id']) && !empty($parent['gravity']) && ($parent['gravity'] == Item::GRAVITY_ACTIVITY)) {
|
if (!empty($parent['thr-parent-id']) && !empty($parent['gravity']) && ($parent['gravity'] == ItemModel::GRAVITY_ACTIVITY)) {
|
||||||
$uriid = $parent['thr-parent-id'];
|
$uriid = $parent['thr-parent-id'];
|
||||||
if (!empty($parent['author-id'])) {
|
if (!empty($parent['author-id'])) {
|
||||||
$activities[$uriid] = ['causer-id' => $parent['author-id']];
|
$activities[$uriid] = ['causer-id' => $parent['author-id']];
|
||||||
|
@ -993,10 +993,10 @@ class Conversation
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($max_comments > 0) {
|
if ($max_comments > 0) {
|
||||||
if (($row['gravity'] == Item::GRAVITY_COMMENT) && (++$commentcounter[$row['parent-uri-id']] > $max_comments)) {
|
if (($row['gravity'] == ItemModel::GRAVITY_COMMENT) && (++$commentcounter[$row['parent-uri-id']] > $max_comments)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (($row['gravity'] == Item::GRAVITY_ACTIVITY) && (++$activitycounter[$row['parent-uri-id']] > $max_comments)) {
|
if (($row['gravity'] == ItemModel::GRAVITY_ACTIVITY) && (++$activitycounter[$row['parent-uri-id']] > $max_comments)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1025,7 @@ class Conversation
|
||||||
$this->profiler->startRecording('rendering');
|
$this->profiler->startRecording('rendering');
|
||||||
$children = [];
|
$children = [];
|
||||||
foreach ($item_list as $i => $item) {
|
foreach ($item_list as $i => $item) {
|
||||||
if ($item['gravity'] != Item::GRAVITY_PARENT) {
|
if ($item['gravity'] != ItemModel::GRAVITY_PARENT) {
|
||||||
if ($recursive) {
|
if ($recursive) {
|
||||||
// Fallback to parent-uri if thr-parent is not set
|
// Fallback to parent-uri if thr-parent is not set
|
||||||
$thr_parent = $item['thr-parent-id'];
|
$thr_parent = $item['thr-parent-id'];
|
||||||
|
@ -1182,7 +1182,7 @@ class Conversation
|
||||||
|
|
||||||
// Extract the top level items
|
// Extract the top level items
|
||||||
foreach ($item_array as $item) {
|
foreach ($item_array as $item) {
|
||||||
if ($item['gravity'] == Item::GRAVITY_PARENT) {
|
if ($item['gravity'] == ItemModel::GRAVITY_PARENT) {
|
||||||
$parents[] = $item;
|
$parents[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Group;
|
use Friendica\Model\Group;
|
||||||
use Friendica\Model\Item as ModelItem;
|
use Friendica\Model\Item as ItemModel;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\Tag;
|
use Friendica\Model\Tag;
|
||||||
use Friendica\Model\Post;
|
use Friendica\Model\Post;
|
||||||
|
@ -331,7 +331,7 @@ class Item
|
||||||
$sub_link = $contact_url = $pm_url = $status_link = '';
|
$sub_link = $contact_url = $pm_url = $status_link = '';
|
||||||
$photos_link = $posts_link = $block_link = $ignore_link = '';
|
$photos_link = $posts_link = $block_link = $ignore_link = '';
|
||||||
|
|
||||||
if (local_user() && local_user() == $item['uid'] && $item['gravity'] == ModelItem::GRAVITY_PARENT && !$item['self'] && !$item['mention']) {
|
if (local_user() && local_user() == $item['uid'] && $item['gravity'] == ItemModel::GRAVITY_PARENT && !$item['self'] && !$item['mention']) {
|
||||||
$sub_link = 'javascript:doFollowThread(' . $item['id'] . '); return false;';
|
$sub_link = 'javascript:doFollowThread(' . $item['id'] . '); return false;';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ class Item
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!empty($item['language'])) {
|
if (!empty($item['language'])) {
|
||||||
$menu[$this->l10n->t('Languages')] = 'javascript:alert(\'' . ModelItem::getLanguageMessage($item) . '\');';
|
$menu[$this->l10n->t('Languages')] = 'javascript:alert(\'' . ItemModel::getLanguageMessage($item) . '\');';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
|
if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
|
||||||
|
@ -470,7 +470,7 @@ class Item
|
||||||
}
|
}
|
||||||
$item['inform'] .= 'cid:' . $contact['id'];
|
$item['inform'] .= 'cid:' . $contact['id'];
|
||||||
|
|
||||||
if (($item['gravity'] == ModelItem::GRAVITY_COMMENT) || empty($contact['cid']) || ($contact['contact-type'] != Contact::TYPE_COMMUNITY)) {
|
if (($item['gravity'] == ItemModel::GRAVITY_COMMENT) || empty($contact['cid']) || ($contact['contact-type'] != Contact::TYPE_COMMUNITY)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,9 +492,9 @@ class Item
|
||||||
}
|
}
|
||||||
Logger::info('Got inform', ['inform' => $item['inform']]);
|
Logger::info('Got inform', ['inform' => $item['inform']]);
|
||||||
|
|
||||||
if (($item['gravity'] == ModelItem::GRAVITY_PARENT) && !empty($forum_contact) && ($private_forum || $only_to_forum)) {
|
if (($item['gravity'] == ItemModel::GRAVITY_PARENT) && !empty($forum_contact) && ($private_forum || $only_to_forum)) {
|
||||||
// we tagged a forum in a top level post. Now we change the post
|
// we tagged a forum in a top level post. Now we change the post
|
||||||
$item['private'] = $private_forum ? ModelItem::PRIVATE : ModelItem::UNLISTED;
|
$item['private'] = $private_forum ? ItemModel::PRIVATE : ItemModel::UNLISTED;
|
||||||
|
|
||||||
if ($only_to_forum) {
|
if ($only_to_forum) {
|
||||||
$item['postopts'] = '';
|
$item['postopts'] = '';
|
||||||
|
@ -510,14 +510,14 @@ class Item
|
||||||
$item['allow_cid'] = '';
|
$item['allow_cid'] = '';
|
||||||
$item['allow_gid'] = '';
|
$item['allow_gid'] = '';
|
||||||
}
|
}
|
||||||
} elseif ($setPermissions && ($item['gravity'] == ModelItem::GRAVITY_PARENT)) {
|
} elseif ($setPermissions && ($item['gravity'] == ItemModel::GRAVITY_PARENT)) {
|
||||||
if (empty($receivers)) {
|
if (empty($receivers)) {
|
||||||
// For security reasons direct posts without any receiver will be posts to yourself
|
// For security reasons direct posts without any receiver will be posts to yourself
|
||||||
$self = Contact::selectFirst(['id'], ['uid' => $item['uid'], 'self' => true]);
|
$self = Contact::selectFirst(['id'], ['uid' => $item['uid'], 'self' => true]);
|
||||||
$receivers[] = $self['id'];
|
$receivers[] = $self['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['private'] = ModelItem::PRIVATE;
|
$item['private'] = ItemModel::PRIVATE;
|
||||||
$item['allow_cid'] = '';
|
$item['allow_cid'] = '';
|
||||||
$item['allow_gid'] = '';
|
$item['allow_gid'] = '';
|
||||||
$item['deny_cid'] = '';
|
$item['deny_cid'] = '';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user