The conversation functionality moved to a class

This commit is contained in:
Michael 2021-09-23 21:18:36 +00:00
parent c9e30ac2c0
commit 0ad904c185
24 changed files with 1545 additions and 1494 deletions

View file

@ -38,7 +38,6 @@ class Bookmarklet extends BaseModule
{
$_GET['mode'] = 'minimal';
$app = DI::app();
$config = DI::config();
if (!local_user()) {
@ -61,7 +60,7 @@ class Bookmarklet extends BaseModule
'title' => trim($_REQUEST['title'] ?? '', '*'),
'content' => $content
];
$output = status_editor($app, $x, 0, false);
$output = DI::conversation()->statusEditor($x, 0, false);
$output .= "<script>window.resizeTo(800,550);</script>";
} else {
$output = '<h2>' . DI::l10n()->t('The post was created') . '</h2>';

View file

@ -951,7 +951,7 @@ class Contact extends BaseModule
if (!$update) {
// We need the editor here to be able to reshare an item.
if (local_user()) {
$o = status_editor($a, [], 0, true);
$o = DI::conversation()->statusEditor([], 0, true);
}
}

View file

@ -127,7 +127,7 @@ class Community extends BaseModule
// We need the editor here to be able to reshare an item.
if (Session::isAuthenticated()) {
$o .= status_editor(DI::app(), [], 0, true);
$o .= DI::conversation()->statusEditor([], 0, true);
}
}
@ -138,7 +138,8 @@ class Community extends BaseModule
return $o;
}
$o .= conversation(DI::app(), $items, 'community', false, false, 'commented', local_user());
// $o .= conversation(DI::app(), $items, 'community', false, false, 'commented', local_user());
$o .= DI::conversation()->create($items, 'community', false, false, 'commented', local_user());
$pager = new BoundariesPager(
DI::l10n(),

View file

@ -145,7 +145,7 @@ class Network extends BaseModule
'content' => $content,
];
$o .= status_editor($a, $x);
$o .= DI::conversation()->statusEditor($x);
}
if (self::$groupId) {
@ -178,7 +178,7 @@ class Network extends BaseModule
$ordering = '`commented`';
}
$o .= conversation(DI::app(), $items, 'network', false, false, $ordering, local_user());
$o .= DI::conversation()->create($items, 'network', false, false, $ordering, local_user());
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
$o .= HTML::scrollLoader();

View file

@ -132,7 +132,7 @@ class Status extends BaseProfile
'profile_uid' => $profile['uid'],
];
$o .= status_editor($a, $x);
$o .= DI::conversation()->statusEditor($x);
}
// Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
@ -224,7 +224,7 @@ class Status extends BaseProfile
$items = array_merge($items, $pinned);
}
$o .= conversation($a, $items, 'profile', false, false, 'pinned_received', $profile['uid']);
$o .= DI::conversation()->create($items, 'profile', false, false, 'pinned_received', $profile['uid']);
$o .= $pager->renderMinimal(count($items));

View file

@ -79,7 +79,7 @@ class Filed extends BaseSearch
$items = Post::toArray(Post::selectForUser(local_user(), Item::DISPLAY_FIELDLIST, $item_condition, $item_params));
$o .= conversation(DI::app(), $items, 'filed', false, false, '', local_user());
$o .= DI::conversation()->create($items, 'filed', false, false, '', local_user());
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
$o .= HTML::scrollLoader();

View file

@ -200,7 +200,7 @@ class Index extends BaseSearch
Logger::info('Start Conversation.', ['q' => $search]);
$o .= conversation(DI::app(), $items, 'search', false, false, 'commented', local_user());
$o .= DI::conversation()->create($items, 'search', false, false, 'commented', local_user());
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
$o .= HTML::scrollLoader();

View file

@ -39,7 +39,7 @@ class Community extends CommunityModule
$o = '';
if (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update')) {
$o = conversation(DI::app(), self::getItems(), 'community', true, false, 'commented', local_user());
$o = DI::conversation()->create(self::getItems(), 'community', true, false, 'commented', local_user());
}
System::htmlUpdateExit($o);

View file

@ -53,7 +53,7 @@ class Network extends NetworkModule
$ordering = '`commented`';
}
$o = conversation(DI::app(), $items, 'network', $profile_uid, false, $ordering, local_user());
$o = DI::conversation()->create($items, 'network', $profile_uid, false, $ordering, local_user());
}
System::htmlUpdateExit($o);

View file

@ -115,7 +115,7 @@ class Profile extends BaseModule
$items = DBA::toArray($items_stmt);
$o .= conversation($a, $items, 'profile', $a->getProfileOwner(), false, 'received', $a->getProfileOwner());
$o .= DI::conversation()->create($items, 'profile', $a->getProfileOwner(), false, 'received', $a->getProfileOwner());
System::htmlUpdateExit($o);
}