Replace "forum" by "group" in the rest of the code
This commit is contained in:
parent
03bebf57c5
commit
3385147f25
59 changed files with 378 additions and 424 deletions
|
@ -615,9 +615,9 @@ class Circle
|
|||
* @param integer $id Contact ID
|
||||
* @return integer Circle ID
|
||||
*/
|
||||
public static function getIdForForum(int $id): int
|
||||
public static function getIdForGroup(int $id): int
|
||||
{
|
||||
Logger::info('Get id for forum id', ['id' => $id]);
|
||||
Logger::info('Get id for group id', ['id' => $id]);
|
||||
$contact = Contact::getById($id, ['uid', 'name', 'contact-type', 'manually-approve']);
|
||||
if (empty($contact) || ($contact['contact-type'] != Contact::TYPE_COMMUNITY) || !$contact['manually-approve']) {
|
||||
return 0;
|
||||
|
@ -645,9 +645,9 @@ class Circle
|
|||
* @param integer $id Contact ID
|
||||
* @return void
|
||||
*/
|
||||
public static function updateMembersForForum(int $id)
|
||||
public static function updateMembersForGroup(int $id)
|
||||
{
|
||||
Logger::info('Update forum members', ['id' => $id]);
|
||||
Logger::info('Update group members', ['id' => $id]);
|
||||
|
||||
$contact = Contact::getById($id, ['uid', 'url']);
|
||||
if (empty($contact)) {
|
||||
|
@ -659,7 +659,7 @@ class Circle
|
|||
return;
|
||||
}
|
||||
|
||||
$gid = self::getIdForForum($id);
|
||||
$gid = self::getIdForGroup($id);
|
||||
if (empty($gid)) {
|
||||
return;
|
||||
}
|
||||
|
@ -682,6 +682,6 @@ class Circle
|
|||
}
|
||||
|
||||
DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $current]);
|
||||
Logger::info('Updated forum members', ['id' => $id, 'count' => DBA::count('group_member', ['gid' => $gid])]);
|
||||
Logger::info('Updated group members', ['id' => $id, 'count' => DBA::count('group_member', ['gid' => $gid])]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class Contact
|
|||
* TYPE_NEWS - the account is a news reflector
|
||||
* Associated page type: PAGE_SOAPBOX
|
||||
*
|
||||
* TYPE_COMMUNITY - the account is community forum
|
||||
* TYPE_COMMUNITY - the account is community group
|
||||
* Associated page types: PAGE_COMMUNITY, PAGE_PRVGROUP
|
||||
*
|
||||
* TYPE_RELAY - the account is a relay
|
||||
|
@ -1652,7 +1652,7 @@ class Contact
|
|||
break;
|
||||
|
||||
case self::TYPE_COMMUNITY:
|
||||
$account_type = DI::l10n()->t("Forum");
|
||||
$account_type = DI::l10n()->t("Group");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3472,13 +3472,13 @@ class Contact
|
|||
}
|
||||
|
||||
/**
|
||||
* Is the contact a forum?
|
||||
* Is the contact a group?
|
||||
*
|
||||
* @param integer $contactid ID of the contact
|
||||
*
|
||||
* @return boolean "true" if it is a forum
|
||||
* @return boolean "true" if it is a group
|
||||
*/
|
||||
public static function isForum(int $contactid): bool
|
||||
public static function isGroup(int $contactid): bool
|
||||
{
|
||||
$fields = ['contact-type'];
|
||||
$condition = ['id' => $contactid];
|
||||
|
@ -3487,7 +3487,7 @@ class Contact
|
|||
return false;
|
||||
}
|
||||
|
||||
// Is it a forum?
|
||||
// Is it a group?
|
||||
return ($contact['contact-type'] == self::TYPE_COMMUNITY);
|
||||
}
|
||||
|
||||
|
|
|
@ -1004,7 +1004,7 @@ class Item
|
|||
$item['deleted'] = $toplevel_parent['deleted'];
|
||||
$item['wall'] = $toplevel_parent['wall'];
|
||||
|
||||
// Reshares have to keep their permissions to allow forums to work
|
||||
// Reshares have to keep their permissions to allow groups to work
|
||||
if (!$defined_permissions && (!$item['origin'] || ($item['verb'] != Activity::ANNOUNCE))) {
|
||||
$item['allow_cid'] = $toplevel_parent['allow_cid'];
|
||||
$item['allow_gid'] = $toplevel_parent['allow_gid'];
|
||||
|
@ -1307,7 +1307,7 @@ class Item
|
|||
|
||||
Post::update($fields, ['uri-id' => $posted_item['parent-uri-id'], 'uid' => $posted_item['uid']]);
|
||||
|
||||
// In that function we check if this is a forum post. Additionally we delete the item under certain circumstances
|
||||
// In that function we check if this is a group post. Additionally we delete the item under certain circumstances
|
||||
if (self::tagDeliver($posted_item['uid'], $post_user_id)) {
|
||||
// Get the user information for the logging
|
||||
$user = User::getById($uid);
|
||||
|
@ -1418,11 +1418,11 @@ class Item
|
|||
}
|
||||
|
||||
/**
|
||||
* Change the owner of a parent item if it had been shared by a forum
|
||||
* Change the owner of a parent item if it had been shared by a group
|
||||
*
|
||||
* (public) forum posts in the new format consist of the regular post by the author
|
||||
* followed by an announce message sent from the forum account.
|
||||
* Changing the owner helps in grouping forum posts.
|
||||
* (public) group posts in the new format consist of the regular post by the author
|
||||
* followed by an announce message sent from the group account.
|
||||
* Changing the owner helps in grouping group posts.
|
||||
*
|
||||
* @param array $item
|
||||
* @return void
|
||||
|
@ -1458,7 +1458,7 @@ class Item
|
|||
}
|
||||
|
||||
if (Contact::isSharing($parent['owner-id'], $item['uid'])) {
|
||||
Logger::info('The resharer is no forum: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
|
||||
Logger::info('The resharer is no group: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1603,7 +1603,7 @@ class Item
|
|||
if (($uid != 0) && ($item['gravity'] == self::GRAVITY_PARENT)) {
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (($owner['contact-type'] == User::ACCOUNT_TYPE_COMMUNITY) && !Tag::isMentioned($uri_id, $owner['url'])) {
|
||||
Logger::info('Target user is a forum but is not mentioned here, thread will not be stored', ['uid' => $uid, 'uri-id' => $uri_id]);
|
||||
Logger::info('Target user is a group but is not mentioned here, thread will not be stored', ['uid' => $uid, 'uri-id' => $uri_id]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1709,7 +1709,7 @@ class Item
|
|||
return 0;
|
||||
}
|
||||
|
||||
// When the post belongs to a a forum then all forum users are allowed to access it
|
||||
// When the post belongs to a a group then all group users are allowed to access it
|
||||
foreach (Tag::getByURIId($uriid, [Tag::MENTION, Tag::EXCLUSIVE_MENTION]) as $tag) {
|
||||
if (DBA::exists('contact', ['uid' => $uid, 'nurl' => Strings::normaliseLink($tag['url']), 'contact-type' => Contact::TYPE_COMMUNITY])) {
|
||||
$target_uid = User::getIdForURL($tag['url']);
|
||||
|
@ -2104,7 +2104,7 @@ class Item
|
|||
/// @todo On private posts we could obfuscate the date
|
||||
$update = ($arr['private'] != self::PRIVATE) || in_array($arr['network'], Protocol::FEDERATED);
|
||||
|
||||
// Is it a forum? Then we don't care about the rules from above
|
||||
// Is it a group? Then we don't care about the rules from above
|
||||
if (!$update && in_array($arr["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN]) && ($arr["parent-uri-id"] === $arr["uri-id"])) {
|
||||
if (DBA::exists('contact', ['id' => $arr['contact-id'], 'forum' => true])) {
|
||||
$update = true;
|
||||
|
@ -2200,7 +2200,7 @@ class Item
|
|||
}
|
||||
|
||||
/**
|
||||
* look for mention tags and setup a second delivery chain for forum/community posts if appropriate
|
||||
* look for mention tags and setup a second delivery chain for group/community posts if appropriate
|
||||
*
|
||||
* @param int $uid
|
||||
* @param int $item_id
|
||||
|
@ -3663,13 +3663,13 @@ class Item
|
|||
}
|
||||
|
||||
/**
|
||||
* Does the given uri-id belongs to a post that is sent as starting post to a forum?
|
||||
* Does the given uri-id belongs to a post that is sent as starting post to a group?
|
||||
*
|
||||
* @param int $uri_id
|
||||
*
|
||||
* @return boolean "true" when it is a forum post
|
||||
* @return boolean "true" when it is a group post
|
||||
*/
|
||||
public static function isForumPost(int $uri_id): bool
|
||||
public static function isGroupPost(int $uri_id): bool
|
||||
{
|
||||
foreach (Tag::getByURIId($uri_id, [Tag::EXCLUSIVE_MENTION]) as $tag) {
|
||||
if (DBA::exists('contact', ['uid' => 0, 'nurl' => Strings::normaliseLink($tag['url']), 'contact-type' => Contact::TYPE_COMMUNITY])) {
|
||||
|
|
|
@ -42,7 +42,7 @@ class Type
|
|||
const TAG_SELF = 128;
|
||||
/** @var int Notification about getting poked/prodded/etc. (Obsolete) */
|
||||
const POKE = 512;
|
||||
/** @var int Notification about either a contact had posted something directly or the contact is a mentioned forum */
|
||||
/** @var int Notification about either a contact had posted something directly or the contact is a mentioned group */
|
||||
const SHARE = 1024;
|
||||
|
||||
/** @var int Global System notifications */
|
||||
|
|
|
@ -830,7 +830,7 @@ class Photo
|
|||
* Changes photo permissions that had been embedded in a post
|
||||
*
|
||||
* @todo This function currently does have some flaws:
|
||||
* - Sharing a post with a forum will create a photo that only the forum can see.
|
||||
* - Sharing a post with a group will create a photo that only the group can see.
|
||||
* - Sharing a photo again that been shared non public before doesn't alter the permissions.
|
||||
*
|
||||
* @return string
|
||||
|
@ -877,7 +877,7 @@ class Photo
|
|||
/**
|
||||
* @todo Existing permissions need to be mixed with the new ones.
|
||||
* Otherwise this creates problems with sharing the same picture multiple times
|
||||
* Also check if $str_contact_allow does contain a public forum.
|
||||
* Also check if $str_contact_allow does contain a public group.
|
||||
* Then set the permissions to public.
|
||||
*/
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class Tag
|
|||
*/
|
||||
const IMPLICIT_MENTION = 8;
|
||||
/**
|
||||
* An exclusive mention transmits the post only to the target account without transmitting it to the followers, usually a forum.
|
||||
* An exclusive mention transmits the post only to the target account without transmitting it to the followers, usually a group.
|
||||
*/
|
||||
const EXCLUSIVE_MENTION = 9;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ class User
|
|||
* ACCOUNT_TYPE_NEWS - the account is a news reflector
|
||||
* Associated page type: PAGE_FLAGS_SOAPBOX
|
||||
*
|
||||
* ACCOUNT_TYPE_COMMUNITY - the account is community forum
|
||||
* ACCOUNT_TYPE_COMMUNITY - the account is community group
|
||||
* Associated page types: PAGE_COMMUNITY, PAGE_FLAGS_PRVGROUP
|
||||
*
|
||||
* ACCOUNT_TYPE_RELAY - the account is a relay
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue