Merge remote-tracking branch 'upstream/develop' into reshare-delivery
This commit is contained in:
@@ -953,12 +953,11 @@ class BBCode extends BaseObject
|
||||
public static function convertShare($text, callable $callback)
|
||||
{
|
||||
$return = preg_replace_callback(
|
||||
"/(.*?)\[share(.*?)\](.*?)\[\/share\]/ism",
|
||||
"/(.*?)\[share(.*?)\](.*)\[\/share\]/ism",
|
||||
function ($match) use ($callback) {
|
||||
$attribute_string = $match[2];
|
||||
|
||||
$attributes = [];
|
||||
foreach(['author', 'profile', 'avatar', 'link', 'posted'] as $field) {
|
||||
foreach (['author', 'profile', 'avatar', 'link', 'posted'] as $field) {
|
||||
preg_match("/$field=(['\"])(.+?)\\1/ism", $attribute_string, $matches);
|
||||
$attributes[$field] = html_entity_decode($matches[2] ?? '', ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
@@ -258,10 +258,20 @@ class ACL extends BaseObject
|
||||
*/
|
||||
public static function getContactListByUserId(int $user_id)
|
||||
{
|
||||
$acl_contacts = Contact::selectToArray(
|
||||
['id', 'name', 'addr', 'micro'],
|
||||
['uid' => $user_id, 'pending' => false, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]]
|
||||
$fields = ['id', 'name', 'addr', 'micro'];
|
||||
$params = ['order' => ['name']];
|
||||
$acl_contacts = Contact::selectToArray($fields,
|
||||
['uid' => $user_id, 'self' => false, 'blocked' => false, 'archive' => false, 'deleted' => false,
|
||||
'pending' => false, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]], $params
|
||||
);
|
||||
|
||||
$acl_forums = Contact::selectToArray($fields,
|
||||
['uid' => $user_id, 'self' => false, 'blocked' => false, 'archive' => false, 'deleted' => false,
|
||||
'pending' => false, 'contact-type' => Contact::TYPE_COMMUNITY], $params
|
||||
);
|
||||
|
||||
$acl_contacts = array_merge($acl_forums, $acl_contacts);
|
||||
|
||||
array_walk($acl_contacts, function (&$value) {
|
||||
$value['type'] = 'contact';
|
||||
});
|
||||
@@ -367,7 +377,7 @@ class ACL extends BaseObject
|
||||
}
|
||||
}
|
||||
|
||||
if ($default_permissions['hidewall']) {
|
||||
if (!$default_permissions['hidewall']) {
|
||||
if ($mail_enabled) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
|
||||
@@ -1458,15 +1458,26 @@ class Contact extends BaseObject
|
||||
if (DBA::isResult($contact)) {
|
||||
$contact_id = $contact["id"];
|
||||
|
||||
// Update the contact every 7 days
|
||||
if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
||||
// Update the contact every 7 days (Don't update mail or feed contacts)
|
||||
if (in_array($contact['network'], Protocol::FEDERATED)) {
|
||||
$update_contact = ($contact['updated'] < DateTimeFormat::utc('now -7 days'));
|
||||
|
||||
// We force the update if the avatar is empty
|
||||
if (empty($contact['avatar'])) {
|
||||
$update_contact = true;
|
||||
}
|
||||
} else {
|
||||
} elseif (empty($default) && in_array($contact['network'], [Protocol::MAIL, Protocol::PHANTOM]) && ($uid == 0)) {
|
||||
// Update public mail accounts via their user's accounts
|
||||
$fields = ['network', 'addr', 'name', 'nick', 'avatar', 'photo', 'thumb', 'micro'];
|
||||
$mailcontact = DBA::selectFirst('contact', $fields, ["`addr` = ? AND `network` = ? AND `uid` != 0", $url, Protocol::MAIL]);
|
||||
if (!DBA::isResult($mailcontact)) {
|
||||
$mailcontact = DBA::selectFirst('contact', $fields, ["`nurl` = ? AND `network` = ? AND `uid` != 0", $url, Protocol::MAIL]);
|
||||
}
|
||||
|
||||
if (DBA::isResult($mailcontact)) {
|
||||
DBA::update('contact', $mailcontact, ['id' => $contact_id]);
|
||||
}
|
||||
|
||||
$update_contact = false;
|
||||
}
|
||||
|
||||
@@ -1743,7 +1754,7 @@ class Contact extends BaseObject
|
||||
$sql = "`item`.`uid` = ?";
|
||||
}
|
||||
|
||||
$contact_field = ($contact["contact-type"] == self::TYPE_COMMUNITY ? 'owner-id' : 'author-id');
|
||||
$contact_field = ((($contact["contact-type"] == self::TYPE_COMMUNITY) || ($contact['network'] == Protocol::MAIL)) ? 'owner-id' : 'author-id');
|
||||
|
||||
if ($thread_mode) {
|
||||
$condition = ["`$contact_field` = ? AND `gravity` = ? AND " . $sql,
|
||||
|
||||
@@ -3833,7 +3833,7 @@ class Item extends BaseObject
|
||||
$body = $shared_item['body'];
|
||||
}
|
||||
|
||||
$item['body'] = preg_replace("/(.*?\[share.*?\]\s?).*?(\s?\[\/share\]\s?)/ism", '$1' . $body . '$2', $item['body']);
|
||||
$item['body'] = preg_replace("/\[share ([^\[\]]*)\].*\[\/share\]/ism", '[share $1]' . $body . '[/share]', $item['body']);
|
||||
unset($shared_item['body']);
|
||||
|
||||
return array_merge($item, $shared_item);
|
||||
|
||||
@@ -64,7 +64,7 @@ class Verify extends BaseModule
|
||||
'$errors_label' => L10n::tt('Error', 'Errors', count(self::$errors)),
|
||||
'$errors' => self::$errors,
|
||||
'$recovery_message' => L10n::t('Don’t have your phone? <a href="%s">Enter a two-factor recovery code</a>', '2fa/recovery'),
|
||||
'$verify_code' => ['verify_code', L10n::t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"'],
|
||||
'$verify_code' => ['verify_code', L10n::t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"', 'number'],
|
||||
'$verify_label' => L10n::t('Verify code and complete login'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -381,16 +381,16 @@ class Transmitter
|
||||
|
||||
$terms = Term::tagArrayFromItemId($item['id'], [Term::MENTION, Term::IMPLICIT_MENTION]);
|
||||
|
||||
// Directly mention the original author upon a quoted reshare.
|
||||
// Else just ensure that the original author receives the reshare.
|
||||
$announce = self::getAnnounceArray($item);
|
||||
if (!empty($announce['comment'])) {
|
||||
$data['to'][] = $announce['actor']['url'];
|
||||
} elseif (!empty($announce)) {
|
||||
$data['cc'][] = $announce['actor']['url'];
|
||||
}
|
||||
|
||||
if (!$item['private']) {
|
||||
// Directly mention the original author upon a quoted reshare.
|
||||
// Else just ensure that the original author receives the reshare.
|
||||
$announce = self::getAnnounceArray($item);
|
||||
if (!empty($announce['comment'])) {
|
||||
$data['to'][] = $announce['actor']['url'];
|
||||
} elseif (!empty($announce)) {
|
||||
$data['cc'][] = $announce['actor']['url'];
|
||||
}
|
||||
|
||||
$data = array_merge($data, self::fetchPermissionBlockFromConversation($item));
|
||||
|
||||
$data['to'][] = ActivityPub::PUBLIC_COLLECTION;
|
||||
|
||||
Reference in New Issue
Block a user