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

@ -102,7 +102,7 @@ class Feature
// Post composition
'composition' => [
DI::l10n()->t('Post Composition Features'),
['aclautomention', DI::l10n()->t('Auto-mention Forums'), DI::l10n()->t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, DI::config()->get('feature_lock', 'aclautomention', false)],
['aclautomention', DI::l10n()->t('Auto-mention Groups'), DI::l10n()->t('Add/remove mention when a group page is selected/deselected in ACL window.'), false, DI::config()->get('feature_lock', 'aclautomention', false)],
['explicit_mentions', DI::l10n()->t('Explicit Mentions'), DI::l10n()->t('Add explicit mentions to comment box for manual control over who gets mentioned in replies.'), false, DI::config()->get('feature_lock', 'explicit_mentions', false)],
['add_abstract', DI::l10n()->t('Add an abstract from ActivityPub content warnings'), DI::l10n()->t('Add an abstract when commenting on ActivityPub posts with a content warning. Abstracts are displayed as content warning on systems like Mastodon or Pleroma.'), false, DI::config()->get('feature_lock', 'add_abstract', false)],
],
@ -116,7 +116,7 @@ class Feature
// Advanced Profile Settings
'advanced_profile' => [
DI::l10n()->t('Advanced Profile Settings'),
['forumlist_profile', DI::l10n()->t('List Forums'), DI::l10n()->t('Show visitors public community forums at the Advanced Profile Page'), false, DI::config()->get('feature_lock', 'forumlist_profile', false)],
['forumlist_profile', DI::l10n()->t('List Groups'), DI::l10n()->t('Show visitors public groups at the Advanced Profile Page'), false, DI::config()->get('feature_lock', 'forumlist_profile', false)],
['tagadelic', DI::l10n()->t('Tag Cloud'), DI::l10n()->t('Provide a personal tag cloud on your profile page'), false, DI::config()->get('feature_lock', 'tagadelic', false)],
['profile_membersince', DI::l10n()->t('Display Membership Date'), DI::l10n()->t('Display membership date in profile'), false, DI::config()->get('feature_lock', 'profile_membersince', false)],
],

View file

@ -29,21 +29,21 @@ use Friendica\DI;
use Friendica\Model\Contact;
/**
* This class handles methods related to the forum functionality
* This class handles methods related to the group functionality
*/
class ForumManager
class GroupManager
{
/**
* Function to list all forums a user is connected with
* Function to list all groups a user is connected with
*
* @param int $uid of the profile owner
* @param boolean $lastitem Sort by lastitem
* @param boolean $showhidden Show forums which are not hidden
* @param boolean $showhidden Show groups which are not hidden
* @param boolean $showprivate Show private groups
*
* @return array
* 'url' => forum url
* 'name' => forum name
* 'url' => group url
* 'name' => group name
* 'id' => number of the key from the array
* 'micro' => contact photo in format micro
* 'thumb' => contact photo in format thumb
@ -76,16 +76,16 @@ class ForumManager
$condition = DBA::mergeConditions($condition, ['hidden' => false]);
}
$forumlist = [];
$groupList = [];
$fields = ['id', 'url', 'name', 'micro', 'thumb', 'avatar', 'network', 'uid'];
$contacts = DBA::select('account-user-view', $fields, $condition, $params);
if (!$contacts) {
return($forumlist);
return $groupList;
}
while ($contact = DBA::fetch($contacts)) {
$forumlist[] = [
$groupList[] = [
'url' => $contact['url'],
'name' => $contact['name'],
'id' => $contact['id'],
@ -95,19 +95,19 @@ class ForumManager
}
DBA::close($contacts);
return($forumlist);
return($groupList);
}
/**
* Forumlist widget
* Group list widget
*
* Sidebar widget to show subscribed friendica forums. If activated
* in the settings, it appears at the notwork page sidebar
* Sidebar widget to show subscribed Friendica groups. If activated
* in the settings, it appears in the network page sidebar
*
* @param string $baseurl Base module path
* @param int $uid The ID of the User
* @param int $cid The contact id which is used to mark a forum as "selected"
* @param int $cid The contact id which is used to mark a group as "selected"
* @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
@ -121,7 +121,7 @@ class ForumManager
$contacts = self::getList($uid, $lastitem, true, true);
$total = count($contacts);
$visible_forums = 10;
$visibleGroups = 10;
if (DBA::isResult($contacts)) {
$id = 0;
@ -129,7 +129,7 @@ class ForumManager
$entries = [];
foreach ($contacts as $contact) {
$selected = (($cid == $contact['id']) ? ' forum-selected' : '');
$selected = (($cid == $contact['id']) ? ' group-selected' : '');
$entry = [
'url' => $baseurl . '/' . $contact['id'],
@ -143,16 +143,16 @@ class ForumManager
$entries[] = $entry;
}
$tpl = Renderer::getMarkupTemplate('widget_forumlist.tpl');
$tpl = Renderer::getMarkupTemplate('widget/group_list.tpl');
$o .= Renderer::replaceMacros(
$tpl,
[
'$title' => DI::l10n()->t('Forums'),
'$forums' => $entries,
'$link_desc' => DI::l10n()->t('External link to forum'),
'$title' => DI::l10n()->t('Groups'),
'$groups' => $entries,
'$link_desc' => DI::l10n()->t('External link to group'),
'$total' => $total,
'$visible_forums' => $visible_forums,
'$visible_groups' => $visibleGroups,
'$showless' => DI::l10n()->t('show less'),
'$showmore' => DI::l10n()->t('show more')]
);
@ -162,9 +162,9 @@ class ForumManager
}
/**
* Format forumlist as contact block
* Format group list as contact block
*
* This function is used to show the forumlist in
* This function is used to show the group list in
* the advanced profile.
*
* @param int $uid The ID of the User
@ -181,7 +181,7 @@ class ForumManager
$o = '';
// place holder in case somebody wants configurability
// placeholder in case somebody wants configurability
$show_total = 9999;
//don't sort by last updated item
@ -191,7 +191,7 @@ class ForumManager
$total_shown = 0;
foreach ($contacts as $contact) {
$o .= HTML::micropro($contact, true, 'forumlist-profile-advanced');
$o .= HTML::micropro($contact, true, 'grouplist-profile-advanced');
$total_shown++;
if ($total_shown == $show_total) {
break;
@ -202,14 +202,14 @@ class ForumManager
}
/**
* count unread forum items
* count unread group items
*
* Count unread items of connected forums and private groups
* Count unread items of connected groups and private groups
*
* @return array
* 'id' => contact id
* 'name' => contact/forum name
* 'count' => counted unseen forum items
* 'name' => contact/group name
* 'count' => counted unseen group items
* @throws \Exception
*/
public static function countUnseenItems()

View file

@ -484,16 +484,16 @@ class Item
{
// Look for any tags and linkify them
$item['inform'] = '';
$private_forum = false;
$private_group = false;
$private_id = null;
$only_to_forum = false;
$forum_contact = [];
$only_to_group = false;
$group_contact = [];
$receivers = [];
// Convert mentions in the body to a unified format
$item['body'] = BBCode::setMentions($item['body'], $item['uid'], $item['network']);
// Search for forum mentions
// Search for group mentions
foreach (Tag::getFromBody($item['body'], Tag::TAG_CHARACTER[Tag::MENTION] . Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]) as $tag) {
$contact = Contact::getByURLForUser($tag[2], $item['uid']);
if (empty($contact)) {
@ -512,37 +512,37 @@ class Item
}
if (!empty($contact['prv']) || ($tag[1] == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION])) {
$private_forum = $contact['prv'];
$only_to_forum = ($tag[1] == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]);
$private_group = $contact['prv'];
$only_to_group = ($tag[1] == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]);
$private_id = $contact['id'];
$forum_contact = $contact;
Logger::info('Private forum or exclusive mention', ['url' => $tag[2], 'mention' => $tag[1]]);
$group_contact = $contact;
Logger::info('Private group or exclusive mention', ['url' => $tag[2], 'mention' => $tag[1]]);
} elseif ($item['allow_cid'] == '<' . $contact['id'] . '>') {
$private_forum = false;
$only_to_forum = true;
$private_group = false;
$only_to_group = true;
$private_id = $contact['id'];
$forum_contact = $contact;
Logger::info('Public forum', ['url' => $tag[2], 'mention' => $tag[1]]);
$group_contact = $contact;
Logger::info('Public group', ['url' => $tag[2], 'mention' => $tag[1]]);
} else {
Logger::info('Post with forum mention will not be converted to a forum post', ['url' => $tag[2], 'mention' => $tag[1]]);
Logger::info('Post with group mention will not be converted to a group post', ['url' => $tag[2], 'mention' => $tag[1]]);
}
}
Logger::info('Got inform', ['inform' => $item['inform']]);
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
$item['private'] = $private_forum ? ItemModel::PRIVATE : ItemModel::UNLISTED;
if (($item['gravity'] == ItemModel::GRAVITY_PARENT) && !empty($group_contact) && ($private_group || $only_to_group)) {
// we tagged a group in a top level post. Now we change the post
$item['private'] = $private_group ? ItemModel::PRIVATE : ItemModel::UNLISTED;
if ($only_to_forum) {
if ($only_to_group) {
$item['postopts'] = '';
}
$item['deny_cid'] = '';
$item['deny_gid'] = '';
if ($private_forum) {
if ($private_group) {
$item['allow_cid'] = '<' . $private_id . '>';
$item['allow_gid'] = '<' . Circle::getIdForForum($forum_contact['id']) . '>';
$item['allow_gid'] = '<' . Circle::getIdForGroup($group_contact['id']) . '>';
} else {
$item['allow_cid'] = '';
$item['allow_gid'] = '';
@ -1011,7 +1011,7 @@ class Item
$post['body'] = $this->bbCodeVideo->transform($post['body']);
$post = $this->setObjectType($post);
// Personal notes must never be altered to a forum post.
// Personal notes must never be altered to a group post.
if ($post['post-type'] != ItemModel::PT_PERSONAL_NOTE) {
// Look for any tags and linkify them
$post = $this->expandTags($post);

View file

@ -123,7 +123,7 @@ class Nav
'$apps' => $this->getAppMenu(),
'$home' => $this->l10n->t('Go back'),
'$clear_notifs' => $this->l10n->t('Clear notifications'),
'$search_hint' => $this->l10n->t('@name, !forum, #tags, content')
'$search_hint' => $this->l10n->t('@name, !group, #tags, content')
]);
Hook::callAll('page_header', $nav);
@ -273,7 +273,7 @@ class Nav
];
if ($this->config->get('system', 'poco_local_search')) {
$nav['searchoption'][] = $this->l10n->t('Forums');
$nav['searchoption'][] = $this->l10n->t('Groups');
}
}

View file

@ -861,7 +861,7 @@ class HTML
'$id' => $id,
'$search_label' => DI::l10n()->t('Search'),
'$save_label' => $save_label,
'$search_hint' => DI::l10n()->t('@name, !forum, #tags, content'),
'$search_hint' => DI::l10n()->t('@name, !group, #tags, content'),
'$mode' => $mode,
'$return_url' => urlencode(Search::getSearchPath($s)),
];
@ -874,7 +874,7 @@ class HTML
];
if (DI::config()->get('system', 'poco_local_search')) {
$values['$searchoption']['forums'] = DI::l10n()->t('Forums');
$values['$searchoption']['groups'] = DI::l10n()->t('Groups');
}
}

View file

@ -530,7 +530,7 @@ class Widget
['ref' => 'person', 'name' => DI::l10n()->t('Persons')],
['ref' => 'organisation', 'name' => DI::l10n()->t('Organisations')],
['ref' => 'news', 'name' => DI::l10n()->t('News')],
['ref' => 'community', 'name' => DI::l10n()->t('Forums')],
['ref' => 'community', 'name' => DI::l10n()->t('Groups')],
];
return self::filter('accounttype', DI::l10n()->t('Account Types'), '',