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

@ -2220,8 +2220,8 @@ class DFRN
GServer::setProtocol($importer['gsid'], Post\DeliveryData::DFRN);
}
// is it a public forum? Private forums aren't exposed with this method
$forum = intval(XML::getFirstNodeValue($xpath, '/atom:feed/dfrn:community/text()'));
// is it a public group? Private groups aren't exposed with this method
$group = intval(XML::getFirstNodeValue($xpath, '/atom:feed/dfrn:community/text()'));
// The account type is new since 3.5.1
if ($xpath->query('/atom:feed/dfrn:account_type')->length > 0) {
@ -2235,17 +2235,17 @@ class DFRN
// Updating the public contact as well
Contact::update(['contact-type' => $accounttype], ['uid' => 0, 'nurl' => $importer['nurl']]);
}
// A forum contact can either have set "forum" or "prv" - but not both
// A group contact can either have set "forum" or "prv" - but not both
if ($accounttype == User::ACCOUNT_TYPE_COMMUNITY) {
// It's a forum, so either set the public or private forum flag
$condition = ['(`forum` != ? OR `prv` != ?) AND `id` = ?', $forum, !$forum, $importer['id']];
Contact::update(['forum' => $forum, 'prv' => !$forum], $condition);
// It's a group, so either set the public or private forum flag
$condition = ['(`forum` != ? OR `prv` != ?) AND `id` = ?', $group, !$group, $importer['id']];
Contact::update(['forum' => $group, 'prv' => !$group], $condition);
// Updating the public contact as well
$condition = ['(`forum` != ? OR `prv` != ?) AND `uid` = 0 AND `nurl` = ?', $forum, !$forum, $importer['nurl']];
Contact::update(['forum' => $forum, 'prv' => !$forum], $condition);
$condition = ['(`forum` != ? OR `prv` != ?) AND `uid` = 0 AND `nurl` = ?', $group, !$group, $importer['nurl']];
Contact::update(['forum' => $group, 'prv' => !$group], $condition);
} else {
// It's not a forum, so remove the flags
// It's not a group, so remove the flags
$condition = ['(`forum` OR `prv`) AND `id` = ?', $importer['id']];
Contact::update(['forum' => false, 'prv' => false], $condition);
@ -2253,13 +2253,13 @@ class DFRN
$condition = ['(`forum` OR `prv`) AND `uid` = 0 AND `nurl` = ?', $importer['nurl']];
Contact::update(['forum' => false, 'prv' => false], $condition);
}
} elseif ($forum != $importer['forum']) { // Deprecated since 3.5.1
$condition = ['`forum` != ? AND `id` = ?', $forum, $importer['id']];
Contact::update(['forum' => $forum], $condition);
} elseif ($group != $importer['forum']) { // Deprecated since 3.5.1
$condition = ['`forum` != ? AND `id` = ?', $group, $importer['id']];
Contact::update(['forum' => $group], $condition);
// Updating the public contact as well
$condition = ['`forum` != ? AND `uid` = 0 AND `nurl` = ?', $forum, $importer['nurl']];
Contact::update(['forum' => $forum], $condition);
$condition = ['`forum` != ? AND `uid` = 0 AND `nurl` = ?', $group, $importer['nurl']];
Contact::update(['forum' => $group], $condition);
}