Merge pull request #9490 from annando/forum-fix
Fix: Posts sent to forums had been rejected
This commit is contained in:
commit
4e65b54b60
|
@ -462,14 +462,12 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
$always_bcc = false;
|
$always_bcc = false;
|
||||||
$isforum = false;
|
|
||||||
|
|
||||||
// Check if we should always deliver our stuff via BCC
|
// Check if we should always deliver our stuff via BCC
|
||||||
if (!empty($item['uid'])) {
|
if (!empty($item['uid'])) {
|
||||||
$profile = User::getOwnerDataById($item['uid']);
|
$profile = User::getOwnerDataById($item['uid']);
|
||||||
if (!empty($profile)) {
|
if (!empty($profile)) {
|
||||||
$always_bcc = $profile['hide-friends'];
|
$always_bcc = $profile['hide-friends'];
|
||||||
$isforum = $profile['account-type'] == User::ACCOUNT_TYPE_COMMUNITY;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +475,7 @@ class Transmitter
|
||||||
$always_bcc = true;
|
$always_bcc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((self::isAnnounce($item) && !$isforum) || DI::config()->get('debug', 'total_ap_delivery')) {
|
if (self::isAnnounce($item) || DI::config()->get('debug', 'total_ap_delivery')) {
|
||||||
// Will be activated in a later step
|
// Will be activated in a later step
|
||||||
$networks = Protocol::FEDERATED;
|
$networks = Protocol::FEDERATED;
|
||||||
} else {
|
} else {
|
||||||
|
@ -531,10 +529,6 @@ class Transmitter
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isforum && DBA::isResult($contact) && ($contact['dfrn'] == Protocol::DFRN)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($profile = APContact::getByURL($contact['url'], false))) {
|
if (!empty($profile = APContact::getByURL($contact['url'], false))) {
|
||||||
$data['to'][] = $profile['url'];
|
$data['to'][] = $profile['url'];
|
||||||
}
|
}
|
||||||
|
@ -547,10 +541,6 @@ class Transmitter
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isforum && DBA::isResult($contact) && ($contact['dfrn'] == Protocol::DFRN)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($profile = APContact::getByURL($contact['url'], false))) {
|
if (!empty($profile = APContact::getByURL($contact['url'], false))) {
|
||||||
if ($contact['hidden'] || $always_bcc) {
|
if ($contact['hidden'] || $always_bcc) {
|
||||||
$data['bcc'][] = $profile['url'];
|
$data['bcc'][] = $profile['url'];
|
||||||
|
|
|
@ -1500,18 +1500,20 @@ class DFRN
|
||||||
|
|
||||||
$fields = ['id', 'uid', 'url', 'network', 'avatar-date', 'avatar', 'name-date', 'uri-date', 'addr',
|
$fields = ['id', 'uid', 'url', 'network', 'avatar-date', 'avatar', 'name-date', 'uri-date', 'addr',
|
||||||
'name', 'nick', 'about', 'location', 'keywords', 'xmpp', 'bdyear', 'bd', 'hidden', 'contact-type'];
|
'name', 'nick', 'about', 'location', 'keywords', 'xmpp', 'bdyear', 'bd', 'hidden', 'contact-type'];
|
||||||
$condition = ["`uid` = ? AND `nurl` = ? AND `network` != ? AND NOT `pending` AND NOT `blocked` AND `rel` IN (?, ?)",
|
$condition = ["`uid` = ? AND `nurl` = ? AND `network` != ? AND NOT `pending` AND NOT `blocked`",
|
||||||
$importer["importer_uid"], Strings::normaliseLink($author["link"]), Protocol::STATUSNET,
|
$importer["importer_uid"], Strings::normaliseLink($author["link"]), Protocol::STATUSNET];
|
||||||
Contact::SHARING, Contact::FRIEND];
|
|
||||||
|
if ($importer['account-type'] != User::ACCOUNT_TYPE_COMMUNITY) {
|
||||||
|
$condition = DBA::mergeConditions($condition, ['rel' => [Contact::SHARING, Contact::FRIEND]]);
|
||||||
|
}
|
||||||
|
|
||||||
$contact_old = DBA::selectFirst('contact', $fields, $condition);
|
$contact_old = DBA::selectFirst('contact', $fields, $condition);
|
||||||
|
|
||||||
if (DBA::isResult($contact_old)) {
|
if (DBA::isResult($contact_old)) {
|
||||||
$author["contact-id"] = $contact_old["id"];
|
$author["contact-id"] = $contact_old["id"];
|
||||||
$author["network"] = $contact_old["network"];
|
$author["network"] = $contact_old["network"];
|
||||||
} else {
|
} else {
|
||||||
if (!$onlyfetch) {
|
Logger::info('Contact not found', ['condition' => $condition]);
|
||||||
Logger::debug("Contact ".$author["link"]." wasn't found for user ".$importer["importer_uid"]." XML: ".$xml);
|
|
||||||
}
|
|
||||||
|
|
||||||
$author["contact-unknown"] = true;
|
$author["contact-unknown"] = true;
|
||||||
$contact = Contact::getByURL($author["link"], null, ["id", "network"]);
|
$contact = Contact::getByURL($author["link"], null, ["id", "network"]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user