Replace "forum" by "group" in the rest of the code

This commit is contained in:
Hypolite Petovan 2023-05-30 09:15:17 -04:00
parent 03bebf57c5
commit 3385147f25
59 changed files with 378 additions and 424 deletions

View file

@ -24,7 +24,7 @@ namespace Friendica\Module\Conversation;
use Friendica\BaseModule;
use Friendica\Content\BoundariesPager;
use Friendica\Content\Conversation;
use Friendica\Content\ForumManager;
use Friendica\Content\GroupManager;
use Friendica\Content\Nav;
use Friendica\Content\Widget;
use Friendica\Content\Text\HTML;
@ -52,7 +52,7 @@ class Network extends BaseModule
/** @var int */
private static $circleId;
/** @var int */
private static $forumContactId;
private static $groupContactId;
/** @var string */
private static $selectedTab;
/** @var mixed */
@ -90,9 +90,9 @@ class Network extends BaseModule
DI::page()['aside'] .= Widget::accountTypes($module, self::$accountTypeString);
DI::page()['aside'] .= Circle::sidebarWidget($module, $module . '/circle', 'standard', self::$circleId);
DI::page()['aside'] .= ForumManager::widget($module . '/forum', DI::userSession()->getLocalUserId(), self::$forumContactId);
DI::page()['aside'] .= GroupManager::widget($module . '/group', DI::userSession()->getLocalUserId(), self::$groupContactId);
DI::page()['aside'] .= Widget::postedByYear($module . '/archive', DI::userSession()->getLocalUserId(), false);
DI::page()['aside'] .= Widget::networks($module, !self::$forumContactId ? self::$network : '');
DI::page()['aside'] .= Widget::networks($module, !self::$groupContactId ? self::$network : '');
DI::page()['aside'] .= Widget\SavedSearches::getHTML(DI::args()->getQueryString());
DI::page()['aside'] .= Widget::fileAs('filed', '');
@ -119,9 +119,9 @@ class Network extends BaseModule
$content = '';
if (self::$forumContactId) {
// If self::$forumContactId belongs to a community forum or a private group, add a mention to the status editor
$condition = ["`id` = ? AND `contact-type` = ?", self::$forumContactId, Contact::TYPE_COMMUNITY];
if (self::$groupContactId) {
// If self::$groupContactId belongs to a community group or a private group, add a mention to the status editor
$condition = ["`id` = ? AND `contact-type` = ?", self::$groupContactId, Contact::TYPE_COMMUNITY];
$contact = DBA::selectFirst('contact', ['addr'], $condition);
if (!empty($contact['addr'])) {
$content = '!' . $contact['addr'];
@ -136,8 +136,8 @@ class Network extends BaseModule
}
$allowedCids = [];
if (self::$forumContactId) {
$allowedCids[] = (int) self::$forumContactId;
if (self::$groupContactId) {
$allowedCids[] = (int) self::$groupContactId;
} elseif (self::$network) {
$condition = [
'uid' => DI::userSession()->getLocalUserId(),
@ -160,9 +160,9 @@ class Network extends BaseModule
}
$x = [
'lockstate' => self::$circleId || self::$forumContactId || self::$network || ACL::getLockstateForUserId($a->getLoggedInUserId()) ? 'lock' : 'unlock',
'lockstate' => self::$circleId || self::$groupContactId || self::$network || ACL::getLockstateForUserId($a->getLoggedInUserId()) ? 'lock' : 'unlock',
'acl' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), true, $default_permissions),
'bang' => ((self::$circleId || self::$forumContactId || self::$network) ? '!' : ''),
'bang' => ((self::$circleId || self::$groupContactId || self::$network) ? '!' : ''),
'content' => $content,
];
@ -178,8 +178,8 @@ class Network extends BaseModule
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
'$title' => DI::l10n()->t('Circle: %s', $circle['name'])
]) . $o;
} elseif (self::$forumContactId) {
$contact = Contact::getById(self::$forumContactId);
} elseif (self::$groupContactId) {
$contact = Contact::getById(self::$groupContactId);
if (DBA::isResult($contact)) {
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('contact/list.tpl'), [
'contacts' => [ModuleContact::getContactTemplateVars($contact)],
@ -307,7 +307,7 @@ class Network extends BaseModule
{
self::$circleId = $this->parameters['circle_id'] ?? 0;
self::$forumContactId = $this->parameters['contact_id'] ?? 0;
self::$groupContactId = $this->parameters['contact_id'] ?? 0;
self::$selectedTab = self::getTimelineOrderBySession(DI::userSession(), DI::pConfig());
@ -413,10 +413,10 @@ class Network extends BaseModule
if (self::$circleId) {
$conditionStrings = DBA::mergeConditions($conditionStrings, ["`contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)", self::$circleId]);
} elseif (self::$forumContactId) {
} elseif (self::$groupContactId) {
$conditionStrings = DBA::mergeConditions($conditionStrings,
["((`contact-id` = ?) OR `uri-id` IN (SELECT `parent-uri-id` FROM `post-user-view` WHERE (`contact-id` = ? AND `gravity` = ? AND `vid` = ? AND `uid` = ?)))",
self::$forumContactId, self::$forumContactId, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), DI::userSession()->getLocalUserId()]);
self::$groupContactId, self::$groupContactId, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), DI::userSession()->getLocalUserId()]);
}
// Currently only the order modes "received" and "commented" are in use
@ -479,7 +479,7 @@ class Network extends BaseModule
// We aren't going to try and figure out at the item, circle, and page
// level which items you've seen and which you haven't. If you're looking
// at the top level network page just mark everything seen.
if (!self::$circleId && !self::$forumContactId && !self::$star && !self::$mention) {
if (!self::$circleId && !self::$groupContactId && !self::$star && !self::$mention) {
$condition = ['unseen' => true, 'uid' => DI::userSession()->getLocalUserId()];
self::setItemsSeenByCondition($condition);
} elseif (!empty($parents)) {