diff --git a/database.sql b/database.sql
index db1d90420..8e0c51157 100644
--- a/database.sql
+++ b/database.sql
@@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2021.03-dev (Red Hot Poker)
--- DB_UPDATE_VERSION 1401
+-- DB_UPDATE_VERSION 1402
-- ------------------------------------------
@@ -1231,11 +1231,11 @@ CREATE TABLE IF NOT EXISTS `post-user` (
INDEX `uid_hidden` (`uid`,`hidden`),
INDEX `event-id` (`event-id`),
INDEX `uid_wall` (`uid`,`wall`),
- INDEX `parent-uri-id` (`parent-uri-id`),
+ INDEX `parent-uri-id_uid` (`parent-uri-id`,`uid`),
INDEX `thr-parent-id` (`thr-parent-id`),
INDEX `external-id` (`external-id`),
INDEX `owner-id` (`owner-id`),
- INDEX `author-id` (`author-id`),
+ INDEX `author-id_uid` (`author-id`,`uid`),
INDEX `causer-id` (`causer-id`),
INDEX `vid` (`vid`),
INDEX `uid_received` (`uid`,`received`),
@@ -1615,6 +1615,7 @@ CREATE VIEW `post-view` AS SELECT
`post-user`.`unseen` AS `unseen`,
`post-user`.`deleted` AS `deleted`,
`post-user`.`origin` AS `origin`,
+ `post-thread-user`.`origin` AS `parent-origin`,
`post-thread-user`.`forum_mode` AS `forum_mode`,
`post-thread-user`.`mention` AS `mention`,
`post-user`.`global` AS `global`,
diff --git a/include/conversation.php b/include/conversation.php
index 5b49bc9dc..193dc33e2 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -160,9 +160,6 @@ function localize_item(&$item)
return;
}
- $Aname = $item['author-name'];
- $Alink = $item['author-link'];
-
$obj = XML::parseString($xmlhead . $item['object']);
$Bname = $obj->title;
@@ -177,9 +174,17 @@ function localize_item(&$item)
}
}
- $A = '[url=' . Contact::magicLink($Alink) . ']' . $Aname . '[/url]';
- $B = '[url=' . Contact::magicLink($Blink) . ']' . $Bname . '[/url]';
- if ($Bphoto != "") {
+ $author = ['uid' => 0, 'id' => $item['author-id'],
+ 'network' => $item['author-network'], 'url' => $item['author-link']];
+ $A = '[url=' . Contact::magicLinkByContact($author) . ']' . $item['author-name'] . '[/url]';
+
+ if (!empty($Blink)) {
+ $B = '[url=' . Contact::magicLink($Blink) . ']' . $Bname . '[/url]';
+ } else {
+ $B = '';
+ }
+
+ if ($Bphoto != "" && !empty($Blink)) {
$Bphoto = '[url=' . Contact::magicLink($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]';
}
@@ -262,11 +267,10 @@ function localize_item(&$item)
}
// add sparkle links to appropriate permalinks
- $author = ['uid' => 0, 'id' => $item['author-id'],
- 'network' => $item['author-network'], 'url' => $item['author-link']];
-
// Only create a redirection to a magic link when logged in
if (!empty($item['plink']) && Session::isAuthenticated()) {
+ $author = ['uid' => 0, 'id' => $item['author-id'],
+ 'network' => $item['author-network'], 'url' => $item['author-link']];
$item['plink'] = Contact::magicLinkByContact($author, $item['plink']);
}
}
@@ -763,7 +767,9 @@ function conversation_fetch_comments($thread_items, bool $pinned, array $activit
}
if (($row['gravity'] == GRAVITY_PARENT) && !empty($row['causer-id'])) {
- $row['reshared'] = DI::l10n()->t('%s reshared this.', '' . htmlentities($name) . '');
+ $causer = ['uid' => 0, 'id' => $row['causer-id'],
+ 'network' => $row['causer-network'], 'url' => $row['causer-link']];
+ $row['reshared'] = DI::l10n()->t('%s reshared this.', '' . htmlentities($name) . '');
}
$row['direction'] = ['direction' => 3, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Reshared') : DI::l10n()->t('Reshared by %s', $name))];
break;
@@ -903,7 +909,7 @@ function item_photo_menu($item) {
$sparkle = (strpos($profile_link, 'redir/') === 0);
$cid = 0;
- $pcid = Contact::getIdForURL($item['author-link'], 0, false);
+ $pcid = $item['author-id'];
$network = '';
$rel = 0;
$condition = ['uid' => local_user(), 'nurl' => Strings::normaliseLink($item['author-link'])];
diff --git a/mod/photos.php b/mod/photos.php
index 71e32d4de..a23eefa7e 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -1454,7 +1454,9 @@ function photos_content(App $a)
continue;
}
- $profile_url = Contact::magicLinkById($item['author-id']);
+ $author = ['uid' => 0, 'id' => $item['author-id'],
+ 'network' => $item['author-network'], 'url' => $item['author-link']];
+ $profile_url = Contact::magicLinkByContact($author);
if (strpos($profile_url, 'redir/') === 0) {
$sparkle = ' sparkle';
} else {
diff --git a/mod/unfollow.php b/mod/unfollow.php
index 54e015cf5..14d789e15 100644
--- a/mod/unfollow.php
+++ b/mod/unfollow.php
@@ -59,7 +59,7 @@ function unfollow_content(App $a)
local_user(), Contact::SHARING, Contact::FRIEND, Strings::normaliseLink($url),
Strings::normaliseLink($url), $url];
- $contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
+ $contact = DBA::selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
if (!DBA::isResult($contact)) {
notice(DI::l10n()->t("You aren't following this contact."));
@@ -99,7 +99,7 @@ function unfollow_content(App $a)
'$submit' => DI::l10n()->t('Submit Request'),
'$cancel' => DI::l10n()->t('Cancel'),
'$url' => $contact['url'],
- '$zrl' => Contact::magicLink($contact['url']),
+ '$zrl' => Contact::magicLinkByContact($contact),
'$url_label' => DI::l10n()->t('Profile URL'),
'$myaddr' => $self['url'],
'$request' => $request,
diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php
index ec7bcab95..dbf7e0a46 100644
--- a/src/Content/ContactSelector.php
+++ b/src/Content/ContactSelector.php
@@ -33,6 +33,9 @@ use Friendica\Util\Strings;
*/
class ContactSelector
{
+ static $serverdata = [];
+ static $server_url = [];
+
/**
* @param string $current current
* @param boolean $disabled optional, default false
@@ -61,6 +64,21 @@ class ContactSelector
return $o;
}
+ private static function getServerForProfile(string $profile)
+ {
+ $server_url = self::getServerURLForProfile($profile);
+
+ if (!empty(self::$serverdata[$server_url])) {
+ return self::$serverdata[$server_url];
+ }
+
+ // Now query the GServer for the platform name
+ $gserver = DBA::selectFirst('gserver', ['platform', 'network'], ['nurl' => $server_url]);
+
+ self::$serverdata[$server_url] = $gserver;
+ return $gserver;
+ }
+
/**
* @param string $profile Profile URL
* @return string Server URL
@@ -68,6 +86,10 @@ class ContactSelector
*/
private static function getServerURLForProfile($profile)
{
+ if (!empty(self::$server_url[$profile])) {
+ return self::$server_url[$profile];
+ }
+
$server_url = '';
// Fetch the server url from the contact table
@@ -83,6 +105,8 @@ class ContactSelector
$server_url = Strings::normaliseLink(Network::unparseURL($parts));
}
+ self::$server_url[$profile] = $server_url;
+
return $server_url;
}
@@ -123,24 +147,19 @@ class ContactSelector
$networkname = str_replace($search, $replace, $network);
if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) {
- $server_url = self::getServerURLForProfile($profile);
+ $gserver = self::getServerForProfile($profile);
- // Now query the GServer for the platform name
- $gserver = DBA::selectFirst('gserver', ['platform', 'network'], ['nurl' => $server_url]);
+ if (!empty($gserver['platform'])) {
+ $platform = $gserver['platform'];
+ } elseif (!empty($gserver['network']) && ($gserver['network'] != Protocol::ACTIVITYPUB)) {
+ $platform = self::networkToName($gserver['network']);
+ }
- if (DBA::isResult($gserver)) {
- if (!empty($gserver['platform'])) {
- $platform = $gserver['platform'];
- } elseif (!empty($gserver['network']) && ($gserver['network'] != Protocol::ACTIVITYPUB)) {
- $platform = self::networkToName($gserver['network']);
- }
+ if (!empty($platform)) {
+ $networkname = $platform;
- if (!empty($platform)) {
- $networkname = $platform;
-
- if ($network == Protocol::ACTIVITYPUB) {
- $networkname .= ' (AP)';
- }
+ if ($network == Protocol::ACTIVITYPUB) {
+ $networkname .= ' (AP)';
}
}
}
@@ -192,12 +211,8 @@ class ContactSelector
$network_icon = str_replace($search, $replace, $network);
if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) {
- $server_url = self::getServerURLForProfile($profile);
-
- // Now query the GServer for the platform name
- $gserver = DBA::selectFirst('gserver', ['platform'], ['nurl' => $server_url]);
-
- if (DBA::isResult($gserver) && !empty($gserver['platform'])) {
+ $gserver = self::getServerForProfile($profile);
+ if (!empty($gserver['platform'])) {
$network_icon = $platform_icons[strtolower($gserver['platform'])] ?? $network_icon;
}
}
diff --git a/src/Content/ForumManager.php b/src/Content/ForumManager.php
index f32b1e349..424f54e0c 100644
--- a/src/Content/ForumManager.php
+++ b/src/Content/ForumManager.php
@@ -71,7 +71,7 @@ class ForumManager
$forumlist = [];
- $fields = ['id', 'url', 'name', 'micro', 'thumb', 'avatar'];
+ $fields = ['id', 'url', 'name', 'micro', 'thumb', 'avatar', 'network', 'uid'];
$condition = [$condition_str, Protocol::DFRN, Protocol::ACTIVITYPUB, $uid];
$contacts = DBA::select('contact', $fields, $condition, $params);
if (!$contacts) {
@@ -127,7 +127,7 @@ class ForumManager
$entry = [
'url' => $baseurl . '/' . $contact['id'],
- 'external_url' => Contact::magicLink($contact['url']),
+ 'external_url' => Contact::magicLinkByContact($contact),
'name' => $contact['name'],
'cid' => $contact['id'],
'selected' => $selected,
diff --git a/src/Content/Text/HTML.php b/src/Content/Text/HTML.php
index c3c43822a..8223aa183 100644
--- a/src/Content/Text/HTML.php
+++ b/src/Content/Text/HTML.php
@@ -837,7 +837,7 @@ class HTML
$redir = false;
if ($redirect) {
- $url = Contact::magicLink($contact['url']);
+ $url = Contact::magicLinkByContact($contact);
if (strpos($url, 'redir/') === 0) {
$sparkle = ' sparkle';
}
diff --git a/src/Content/Widget.php b/src/Content/Widget.php
index 8f3edada2..032b9e753 100644
--- a/src/Content/Widget.php
+++ b/src/Content/Widget.php
@@ -22,6 +22,7 @@
namespace Friendica\Content;
use Friendica\Core\Addon;
+use Friendica\Core\Cache\Duration;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
@@ -266,7 +267,7 @@ class Widget
$extra_sql = self::unavailableNetworks();
- $r = DBA::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND NOT `deleted` AND `network` != '' $extra_sql ORDER BY `network`",
+ $r = DBA::p("SELECT `network` FROM `contact` WHERE `uid` = ? AND NOT `deleted` AND `network` != '' $extra_sql GROUP BY `network` ORDER BY `network`",
local_user()
);
@@ -395,7 +396,7 @@ class Widget
$entries = [];
foreach ($commonContacts as $contact) {
$entries[] = [
- 'url' => Contact::magicLink($contact['url']),
+ 'url' => Contact::magicLinkByContact($contact),
'name' => $contact['name'],
'photo' => Contact::getThumb($contact),
];
@@ -460,7 +461,13 @@ class Widget
$ret = [];
- $dthen = Item::firstPostDate($uid, $wall);
+ $cachekey = 'Widget::postedByYear' . $uid . '-' . (int)$wall;
+ $dthen = DI::cache()->get($cachekey);
+ if (!empty($dthen)) {
+ $dthen = Item::firstPostDate($uid, $wall);
+ DI::cache()->set($cachekey, $dthen, Duration::HOUR);
+ }
+
if ($dthen) {
// Set the start and end date to the beginning of the month
$dnow = substr($dnow, 0, 8) . '01';
diff --git a/src/Core/ACL.php b/src/Core/ACL.php
index 5f69d78b6..0da636699 100644
--- a/src/Core/ACL.php
+++ b/src/Core/ACL.php
@@ -144,6 +144,7 @@ class ACL
'archive' => false,
'deleted' => false,
'pending' => false,
+ 'network' => Protocol::FEDERATED,
'rel' => [Contact::FOLLOWER, Contact::FRIEND]
], $condition),
$params
@@ -156,7 +157,7 @@ class ACL
$acl_forums = Contact::selectToArray($fields,
['uid' => $user_id, 'self' => false, 'blocked' => false, 'archive' => false, 'deleted' => false,
- 'pending' => false, 'contact-type' => Contact::TYPE_COMMUNITY], $params
+ 'network' => Protocol::FEDERATED, 'pending' => false, 'contact-type' => Contact::TYPE_COMMUNITY], $params
);
$acl_contacts = array_merge($acl_forums, $acl_contacts);
diff --git a/src/Model/Contact.php b/src/Model/Contact.php
index 5a3f0aaef..302941385 100644
--- a/src/Model/Contact.php
+++ b/src/Model/Contact.php
@@ -905,7 +905,7 @@ class Contact
if (empty($contact['uid']) || ($contact['uid'] != $uid)) {
if ($uid == 0) {
- $profile_link = self::magicLink($contact['url']);
+ $profile_link = self::magicLinkByContact($contact);
$menu = ['profile' => [DI::l10n()->t('View Profile'), $profile_link, true]];
return $menu;
@@ -2684,11 +2684,11 @@ class Contact
return 'contact/' . $contact['id'] . '/conversations';
}
- if ($contact['network'] != Protocol::DFRN) {
+ if (!empty($contact['network']) && $contact['network'] != Protocol::DFRN) {
return $destination;
}
- if (!empty($contact['uid'])) {
+ if (!empty($contact['uid']) || empty($contact['network'])) {
return self::magicLink($contact['url'], $url);
}
@@ -2819,22 +2819,22 @@ class Contact
}
/**
- * Returns a random, global contact of the current node
+ * Returns a random, global contact array of the current node
*
- * @return string The profile URL
+ * @return array The profile array
* @throws Exception
*/
- public static function getRandomUrl()
+ public static function getRandomContact()
{
- $r = DBA::selectFirst('contact', ['url'], [
+ $contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'uid'], [
"`uid` = ? AND `network` = ? AND NOT `failed` AND `last-item` > ?",
0, Protocol::DFRN, DateTimeFormat::utc('now - 1 month'),
], ['order' => ['RAND()']]);
- if (DBA::isResult($r)) {
- return $r['url'];
+ if (DBA::isResult($contact)) {
+ return $contact;
}
- return '';
+ return [];
}
}
diff --git a/src/Model/Event.php b/src/Model/Event.php
index e6c609283..604b1ffcc 100644
--- a/src/Model/Event.php
+++ b/src/Model/Event.php
@@ -930,7 +930,9 @@ class Event
$location = self::locationToArray($item['event-location']);
// Construct the profile link (magic-auth).
- $profile_link = Contact::magicLinkById($item['author-id']);
+ $author = ['uid' => 0, 'id' => $item['author-id'],
+ 'network' => $item['author-network'], 'url' => $item['author-link']];
+ $profile_link = Contact::magicLinkByContact($author);
$tpl = Renderer::getMarkupTemplate('event_stream_item.tpl');
$return = Renderer::replaceMacros($tpl, [
diff --git a/src/Model/Item.php b/src/Model/Item.php
index 40208e4e5..9046674e7 100644
--- a/src/Model/Item.php
+++ b/src/Model/Item.php
@@ -32,7 +32,6 @@ use Friendica\Core\System;
use Friendica\Model\Tag;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
-use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Post;
use Friendica\Protocol\Activity;
@@ -75,12 +74,12 @@ class Item
'uid', 'id', 'parent', 'guid', 'network', 'gravity',
'uri-id', 'uri', 'thr-parent-id', 'thr-parent', 'parent-uri-id', 'parent-uri',
'commented', 'created', 'edited', 'received', 'verb', 'object-type', 'postopts', 'plink',
- 'wall', 'private', 'starred', 'origin', 'title', 'body', 'language',
+ 'wall', 'private', 'starred', 'origin', 'parent-origin', 'title', 'body', 'language',
'content-warning', 'location', 'coord', 'app', 'rendered-hash', 'rendered-html', 'object',
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network',
'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network',
- 'causer-id', 'causer-link', 'causer-name', 'causer-avatar', 'causer-contact-type',
+ 'causer-id', 'causer-link', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network',
'contact-id', 'contact-uid', 'contact-link', 'contact-name', 'contact-avatar',
'writable', 'self', 'cid', 'alias',
'event-created', 'event-edited', 'event-start', 'event-finish',
@@ -2196,7 +2195,8 @@ class Item
$params = ['order' => ['received' => false]];
$thread = Post::selectFirst(['received'], $condition, $params);
if (DBA::isResult($thread)) {
- return substr(DateTimeFormat::local($thread['received']), 0, 10);
+ $postdate = substr(DateTimeFormat::local($thread['received']), 0, 10);
+ return $postdate;
}
return false;
}
@@ -2673,7 +2673,9 @@ class Item
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) {
$mime = $attachment['mimetype'];
- $the_url = Contact::magicLinkById($item['author-id'], $attachment['url']);
+ $author = ['uid' => 0, 'id' => $item['author-id'],
+ 'network' => $item['author-network'], 'url' => $item['author-link']];
+ $the_url = Contact::magicLinkByContact($author, $attachment['url']);
if (strpos($mime, 'video') !== false) {
if (!$vhead) {
diff --git a/src/Model/Profile.php b/src/Model/Profile.php
index 676cd0b40..bc008914b 100644
--- a/src/Model/Profile.php
+++ b/src/Model/Profile.php
@@ -539,7 +539,7 @@ class Profile
$today = (((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) ? true : false);
- $rr['link'] = Contact::magicLink($rr['url']);
+ $rr['link'] = Contact::magicLinkById($rr['cid']);
$rr['title'] = $rr['name'];
$rr['date'] = DI::l10n()->getDay(DateTimeFormat::convert($rr['start'], $a->timezone, 'UTC', $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . DI::l10n()->t('[today]') : '');
$rr['startime'] = null;
diff --git a/src/Model/Tag.php b/src/Model/Tag.php
index 63a4ff492..c63ba0a83 100644
--- a/src/Model/Tag.php
+++ b/src/Model/Tag.php
@@ -407,7 +407,7 @@ class Tag
$searchpath = DI::baseUrl() . "/search?tag=";
- $taglist = DBA::select('tag-view', ['type', 'name', 'url'],
+ $taglist = DBA::select('tag-view', ['type', 'name', 'url', 'cid'],
['uri-id' => $item['uri-id'], 'type' => [self::HASHTAG, self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION]]);
while ($tag = DBA::fetch($taglist)) {
if ($tag['url'] == '') {
@@ -428,7 +428,11 @@ class Tag
break;
case self::MENTION:
case self::EXCLUSIVE_MENTION:
+ if (!empty($tag['cid'])) {
+ $tag['url'] = Contact::magicLinkById($tag['cid']);
+ } else {
$tag['url'] = Contact::magicLink($tag['url']);
+ }
$return['mentions'][] = $prefix . '' . htmlspecialchars($tag['name']) . '';
$return['tags'][] = $prefix . '' . htmlspecialchars($tag['name']) . '';
break;
diff --git a/src/Module/Contact.php b/src/Module/Contact.php
index f82b7d3cc..3eb261d0d 100644
--- a/src/Module/Contact.php
+++ b/src/Module/Contact.php
@@ -518,7 +518,7 @@ class Contact extends BaseModule
$relation_text = sprintf($relation_text, $contact['name']);
- $url = Model\Contact::magicLink($contact['url']);
+ $url = Model\Contact::magicLinkByContact($contact);
if (strpos($url, 'redir/') === 0) {
$sparkle = ' class="sparkle" ';
} else {
@@ -1076,7 +1076,7 @@ class Contact extends BaseModule
}
}
- $url = Model\Contact::magicLink($contact['url']);
+ $url = Model\Contact::magicLinkByContact($contact);
if (strpos($url, 'redir/') === 0) {
$sparkle = ' class="sparkle" ';
diff --git a/src/Module/Contact/Hovercard.php b/src/Module/Contact/Hovercard.php
index c67d6d247..840177d86 100644
--- a/src/Module/Contact/Hovercard.php
+++ b/src/Module/Contact/Hovercard.php
@@ -94,7 +94,7 @@ class Hovercard extends BaseModule
'nick' => $contact['nick'],
'addr' => $contact['addr'] ?: $contact['url'],
'thumb' => Contact::getThumb($contact),
- 'url' => Contact::magicLink($contact['url']),
+ 'url' => Contact::magicLinkByContact($contact),
'nurl' => $contact['nurl'],
'location' => $contact['location'],
'about' => $contact['about'],
diff --git a/src/Module/Debug/ItemBody.php b/src/Module/Debug/ItemBody.php
index dea8bec13..ae01caf23 100644
--- a/src/Module/Debug/ItemBody.php
+++ b/src/Module/Debug/ItemBody.php
@@ -47,7 +47,7 @@ class ItemBody extends BaseModule
throw new HTTPException\NotFoundException(DI::l10n()->t('Item not found.'));
}
- $item = Post::selectFirst(['body'], ['uid' => local_user(), 'id' => $itemId]);
+ $item = Post::selectFirst(['body'], ['uid' => local_user(), 'uri-id' => $itemId]);
if (!empty($item)) {
if (DI::mode()->isAjax()) {
diff --git a/src/Module/RandomProfile.php b/src/Module/RandomProfile.php
index 65ce56595..163fec60f 100644
--- a/src/Module/RandomProfile.php
+++ b/src/Module/RandomProfile.php
@@ -34,10 +34,10 @@ class RandomProfile extends BaseModule
{
$a = DI::app();
- $contactUrl = Contact::getRandomUrl();
+ $contact = Contact::getRandomContact();
- if ($contactUrl) {
- $link = Contact::magicLink($contactUrl);
+ if (!empty($contact)) {
+ $link = Contact::magicLinkByContact($contact);
$a->redirect($link);
}
diff --git a/src/Object/Post.php b/src/Object/Post.php
index 156b602e9..5996f20d0 100644
--- a/src/Object/Post.php
+++ b/src/Object/Post.php
@@ -208,16 +208,9 @@ class Post
$dropping = true;
}
- $origin = $item['origin'];
+ $origin = $item['origin'] || $item['parent-origin'];
- if (!$origin) {
- /// @todo This shouldn't be done as query here, but better during the data creation.
- // it is now done here, since during the RC phase we shouldn't make to intense changes.
- $parent = PostModel::selectFirst(['origin'], ['id' => $item['parent']]);
- if (DBA::isResult($parent)) {
- $origin = $parent['origin'];
- }
- } elseif ($item['pinned']) {
+ if ($item['pinned']) {
$pinned = DI::l10n()->t('pinned item');
}
@@ -252,10 +245,9 @@ class Post
$profile_name = $item['author-link'];
}
- $author = ['uid' => 0, 'id' => $item['author-id'],
- 'network' => $item['author-network'], 'url' => $item['author-link']];
-
if (Session::isAuthenticated()) {
+ $author = ['uid' => 0, 'id' => $item['author-id'],
+ 'network' => $item['author-network'], 'url' => $item['author-link']];
$profile_link = Contact::magicLinkByContact($author);
} else {
$profile_link = $item['author-link'];
@@ -1005,7 +997,7 @@ class Post
// This will have been stored in $a->page_contact by our calling page.
// Put this person as the wall owner of the wall-to-wall notice.
- $this->owner_url = Contact::magicLink($a->page_contact['url']);
+ $this->owner_url = Contact::magicLinkByContact($a->page_contact);
$this->owner_photo = $a->page_contact['thumb'];
$this->owner_name = $a->page_contact['name'];
$this->wall_to_wall = true;
diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php
index d7408c11b..5f05711c5 100644
--- a/static/dbstructure.config.php
+++ b/static/dbstructure.config.php
@@ -55,7 +55,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1401);
+ define('DB_UPDATE_VERSION', 1402);
}
return [
@@ -1279,11 +1279,11 @@ return [
"uid_hidden" => ["uid", "hidden"],
"event-id" => ["event-id"],
"uid_wall" => ["uid", "wall"],
- "parent-uri-id" => ["parent-uri-id"],
+ "parent-uri-id_uid" => ["parent-uri-id", "uid"],
"thr-parent-id" => ["thr-parent-id"],
"external-id" => ["external-id"],
"owner-id" => ["owner-id"],
- "author-id" => ["author-id"],
+ "author-id_uid" => ["author-id", "uid"],
"causer-id" => ["causer-id"],
"vid" => ["vid"],
"uid_received" => ["uid", "received"],
diff --git a/static/dbview.config.php b/static/dbview.config.php
index fcd04c968..dbd8b1980 100644
--- a/static/dbview.config.php
+++ b/static/dbview.config.php
@@ -68,6 +68,7 @@
"unseen" => ["post-user", "unseen"],
"deleted" => ["post-user", "deleted"],
"origin" => ["post-user", "origin"],
+ "parent-origin" => ["post-thread-user", "origin"],
"forum_mode" => ["post-thread-user", "forum_mode"],
"mention" => ["post-thread-user", "mention"],
"global" => ["post-user", "global"],