Merge remote-tracking branch 'upstream/2020.03-rc' into issue-8371-a

This commit is contained in:
Michael 2020-03-21 18:08:33 +00:00
commit d04c9b4930
3 changed files with 2599 additions and 2541 deletions

View file

@ -174,39 +174,39 @@ function notification($params)
// "George Bull's post" // "George Bull's post"
if ($params['activity']['origin_comment']) { if ($params['activity']['origin_comment']) {
$message = '%1$s replied to you on %2$s\'s %3$s %4$s'; $message = $l10n->t('%1$s replied to you on %2$s\'s %3$s %4$s');
} elseif ($params['activity']['explicit_tagged']) { } elseif ($params['activity']['explicit_tagged']) {
$message = '%1$s tagged you on %2$s\'s %3$s %4$s'; $message = $l10n->t('$l10n->t(%1$s tagged you on %2$s\'s %3$s %4$s');
} else { } else {
$message = '%1$s commented on %2$s\'s %3$s %4$s'; $message = $l10n->t('%1$s commented on %2$s\'s %3$s %4$s');
} }
$dest_str = $l10n->t($message, $params['source_name'], $item['author-name'], $item_post_type, $title); $dest_str = sprintf($message, $params['source_name'], $item['author-name'], $item_post_type, $title);
// Then look for the special cases // Then look for the special cases
// "your post" // "your post"
if ($params['activity']['origin_thread']) { if ($params['activity']['origin_thread']) {
if ($params['activity']['origin_comment']) { if ($params['activity']['origin_comment']) {
$message = '%1$s replied to you on your %2$s %3$s'; $message = $l10n->t('%1$s replied to you on your %2$s %3$s');
} elseif ($params['activity']['explicit_tagged']) { } elseif ($params['activity']['explicit_tagged']) {
$message = '%1$s tagged you on your %2$s %3$s'; $message = $l10n->t('%1$s tagged you on your %2$s %3$s');
} else { } else {
$message = '%1$s commented on your %2$s %3$s'; $message = $l10n->t('%1$s commented on your %2$s %3$s');
} }
$dest_str = $l10n->t($message, $params['source_name'], $item_post_type, $title); $dest_str = sprintf($message, $params['source_name'], $item_post_type, $title);
// "their post" // "their post"
} elseif ($item['author-link'] == $params['source_link']) { } elseif ($item['author-link'] == $params['source_link']) {
if ($params['activity']['origin_comment']) { if ($params['activity']['origin_comment']) {
$message = '%1$s replied to you on their %2$s %3$s'; $message = $l10n->t('%1$s replied to you on their %2$s %3$s');
} elseif ($params['activity']['explicit_tagged']) { } elseif ($params['activity']['explicit_tagged']) {
$message = '%1$s tagged you on their %2$s %3$s'; $message = $l10n->t('%1$s tagged you on their %2$s %3$s');
} else { } else {
$message = '%1$s commented on their %2$s %3$s'; $message = $l10n->t('%1$s commented on their %2$s %3$s');
} }
$dest_str = $l10n->t($message, $params['source_name'], $item_post_type, $title); $dest_str = sprintf($message, $params['source_name'], $item_post_type, $title);
} }
// Some mail software relies on subject field for threading. // Some mail software relies on subject field for threading.

View file

@ -128,7 +128,7 @@ function item_post(App $a) {
$thread_parent_contact = Contact::getDetailsByURL($toplevel_item["author-link"]); $thread_parent_contact = Contact::getDetailsByURL($toplevel_item["author-link"]);
if ($toplevel_item['id'] != $toplevel_item['parent']) { if ($toplevel_item['id'] != $toplevel_item['parent']) {
$toplevel_item = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $toplevel_item['parent']]); $toplevel_item = Item::selectFirst([], ['id' => $toplevel_item['parent']]);
} }
} }
@ -244,10 +244,10 @@ function item_post(App $a) {
$body = preg_replace('#\[url=([^\]]*?)\]\[/url\]#ism', '[url]$1[/url]', $body); $body = preg_replace('#\[url=([^\]]*?)\]\[/url\]#ism', '[url]$1[/url]', $body);
if (!empty($orig_post)) { if (!empty($orig_post)) {
$str_group_allow = $orig_post['allow_gid']; $str_group_allow = $orig_post['allow_gid'] ?? '';
$str_contact_allow = $orig_post['allow_cid']; $str_contact_allow = $orig_post['allow_cid'] ?? '';
$str_group_deny = $orig_post['deny_gid']; $str_group_deny = $orig_post['deny_gid'] ?? '';
$str_contact_deny = $orig_post['deny_cid']; $str_contact_deny = $orig_post['deny_cid'] ?? '';
$location = $orig_post['location']; $location = $orig_post['location'];
$coord = $orig_post['coord']; $coord = $orig_post['coord'];
$verb = $orig_post['verb']; $verb = $orig_post['verb'];
@ -261,33 +261,13 @@ function item_post(App $a) {
$network = $orig_post['network']; $network = $orig_post['network'];
$guid = $orig_post['guid']; $guid = $orig_post['guid'];
$extid = $orig_post['extid']; $extid = $orig_post['extid'];
} else { } else {
$aclFormatter = DI::aclFormatter();
/* $str_group_allow = isset($_REQUEST['group_allow']) ? $aclFormatter->toString($_REQUEST['group_allow']) : $user['allow_gid'] ?? '';
* if coming from the API and no privacy settings are set, $str_contact_allow = isset($_REQUEST['contact_allow']) ? $aclFormatter->toString($_REQUEST['contact__allow']) : $user['allow_cid'] ?? '';
* use the user default permissions - as they won't have $str_group_deny = isset($_REQUEST['group_deny']) ? $aclFormatter->toString($_REQUEST['group_deny']) : $user['deny_gid'] ?? '';
* been supplied via a form. $str_contact_deny = isset($_REQUEST['contact_deny']) ? $aclFormatter->toString($_REQUEST['contact_deny']) : $user['deny_cid'] ?? '';
*/
if ($api_source
&& !array_key_exists('contact_allow', $_REQUEST)
&& !array_key_exists('group_allow', $_REQUEST)
&& !array_key_exists('contact_deny', $_REQUEST)
&& !array_key_exists('group_deny', $_REQUEST)) {
$str_group_allow = $user['allow_gid'];
$str_contact_allow = $user['allow_cid'];
$str_group_deny = $user['deny_gid'];
$str_contact_deny = $user['deny_cid'];
} else {
// use the posted permissions
$aclFormatter = DI::aclFormatter();
$str_group_allow = $aclFormatter->toString($_REQUEST['group_allow'] ?? '');
$str_contact_allow = $aclFormatter->toString($_REQUEST['contact_allow'] ?? '');
$str_group_deny = $aclFormatter->toString($_REQUEST['group_deny'] ?? '');
$str_contact_deny = $aclFormatter->toString($_REQUEST['contact_deny'] ?? '');
}
$title = Strings::escapeTags(trim($_REQUEST['title'] ?? '')); $title = Strings::escapeTags(trim($_REQUEST['title'] ?? ''));
$location = Strings::escapeTags(trim($_REQUEST['location'] ?? '')); $location = Strings::escapeTags(trim($_REQUEST['location'] ?? ''));
@ -318,10 +298,10 @@ function item_post(App $a) {
$network = $toplevel_item['network']; $network = $toplevel_item['network'];
} }
$str_contact_allow = $toplevel_item['allow_cid']; $str_contact_allow = $toplevel_item['allow_cid'] ?? '';
$str_group_allow = $toplevel_item['allow_gid']; $str_group_allow = $toplevel_item['allow_gid'] ?? '';
$str_contact_deny = $toplevel_item['deny_cid']; $str_contact_deny = $toplevel_item['deny_cid'] ?? '';
$str_group_deny = $toplevel_item['deny_gid']; $str_group_deny = $toplevel_item['deny_gid'] ?? '';
$private = $toplevel_item['private']; $private = $toplevel_item['private'];
$wall = $toplevel_item['wall']; $wall = $toplevel_item['wall'];

File diff suppressed because it is too large Load diff