* @}
*/
- /**
+ const MIRROR_DEACTIVATED = 0;
+ const MIRROR_FORWARDED = 1;
+ const MIRROR_OWN_POST = 2;
+ const MIRROR_NATIVE_RESHARE = 3;
+
+ /**
* @param array $fields Array of selected fields, empty for all
* @param array $condition Array of fields for condition
* @param array $params Array of several parameters
$contact_field = ((($contact["contact-type"] == self::TYPE_COMMUNITY) || ($contact['network'] == Protocol::MAIL)) ? 'owner-id' : 'author-id');
if ($thread_mode) {
- $condition = ["(`$contact_field` = ? OR (`causer-id` = ? AND `post-type` = ?)) AND `gravity` = ? AND " . $sql,
- $cid, $cid, Item::PT_ANNOUNCEMENT, GRAVITY_PARENT, local_user()];
+ $condition = ["((`$contact_field` = ? AND `gravity` = ?) OR (`author-id` = ? AND `gravity` = ? AND `vid` = ?)) AND " . $sql,
+ $cid, GRAVITY_PARENT, $cid, GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), local_user()];
} else {
$condition = ["`$contact_field` = ? AND `gravity` IN (?, ?) AND " . $sql,
$cid, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()];
}
if ($thread_mode) {
- $r = Item::selectForUser(local_user(), ['uri', 'gravity', 'parent-uri'], $condition, $params);
+ $r = Item::selectForUser(local_user(), ['uri', 'gravity', 'parent-uri', 'thr-parent-id', 'author-id'], $condition, $params);
$items = [];
while ($item = DBA::fetch($r)) {
- if ($item['gravity'] != GRAVITY_PARENT) {
- $item['uri'] = $item['parent-uri'];
- }
- unset($item['parent-uri']);
- unset($item['gravity']);
-
$items[] = $item;
}
DBA::close($r);
in_array($user['page-flags'], [User::PAGE_FLAGS_NORMAL])) {
notification([
- 'type' => Type::INTRO,
- 'notify_flags' => $user['notify-flags'],
- 'language' => $user['language'],
- 'to_name' => $user['username'],
- 'to_email' => $user['email'],
- 'uid' => $user['uid'],
- 'link' => DI::baseUrl() . '/notifications/intros',
- 'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : DI::l10n()->t('[Name Withheld]')),
- 'source_link' => $contact_record['url'],
- 'source_photo' => $contact_record['photo'],
- 'verb' => ($sharing ? Activity::FRIEND : Activity::FOLLOW),
- 'otype' => 'intro'
+ 'type' => Type::INTRO,
+ 'otype' => Notify\ObjectType::INTRO,
+ 'verb' => ($sharing ? Activity::FRIEND : Activity::FOLLOW),
+ 'uid' => $user['uid'],
+ 'cid' => $contact_record['id'],
+ 'link' => DI::baseUrl() . '/notifications/intros',
]);
}
} elseif (DBA::isResult($user) && in_array($user['page-flags'], [User::PAGE_FLAGS_SOAPBOX, User::PAGE_FLAGS_FREELOVE, User::PAGE_FLAGS_COMMUNITY])) {