Channels are a new way to see different content

This commit is contained in:
Michael
2023-09-01 21:56:59 +00:00
parent 5c26ba5f5d
commit 5c166be3fc
22 changed files with 860 additions and 249 deletions

View File

@@ -57,6 +57,7 @@ use Psr\Log\LoggerInterface;
class Conversation
{
const MODE_CHANNEL = 'channel';
const MODE_COMMUNITY = 'community';
const MODE_CONTACTS = 'contacts';
const MODE_CONTACT_POSTS = 'contact-posts';
@@ -530,6 +531,17 @@ class Conversation
. "<script> var profile_uid = " . ($this->session->getLocalUserId() ?: 0) . ";"
. "</script>";
}
} elseif ($mode === self::MODE_CHANNEL) {
$items = $this->addChildren($items, true, $order, $uid, $mode, $ignoredGsids);
if (!$update) {
$live_update_div = '<div id="live-channel"></div>' . "\r\n"
. "<script> var profile_uid = -1; var netargs = '" . substr($this->args->getCommand(), 10)
. '?f='
. (!empty($_GET['no_sharer']) ? '&no_sharer=' . rawurlencode($_GET['no_sharer']) : '')
. (!empty($_GET['accounttype']) ? '&accounttype=' . rawurlencode($_GET['accounttype']) : '')
. "'; </script>\r\n";
}
} elseif ($mode === self::MODE_COMMUNITY) {
$items = $this->addChildren($items, true, $order, $uid, $mode, $ignoredGsids);
@@ -621,7 +633,7 @@ class Conversation
unset($conv_responses['dislike']);
}
if (in_array($mode, [self::MODE_COMMUNITY, self::MODE_CONTACTS, self::MODE_PROFILE])) {
if (in_array($mode, [self::MODE_CHANNEL, self::MODE_COMMUNITY, self::MODE_CONTACTS, self::MODE_PROFILE])) {
$writable = true;
} else {
$writable = $items[0]['writable'] || ($items[0]['uid'] == 0) && in_array($items[0]['network'], Protocol::FEDERATED);
@@ -1009,7 +1021,7 @@ class Conversation
$items[$key]['user-collapsed-owner'] = !$always_display && in_array($row['owner-id'], $collapses);
if (
in_array($mode, [self::MODE_COMMUNITY, self::MODE_NETWORK]) &&
in_array($mode, [self::MODE_CHANNEL, self::MODE_COMMUNITY, self::MODE_NETWORK]) &&
(in_array($row['author-id'], $blocks) || in_array($row['owner-id'], $blocks) || in_array($row['author-id'], $ignores) || in_array($row['owner-id'], $ignores))
) {
unset($items[$key]);