diff --git a/include/conversation.php b/include/conversation.php index cd9e098990..c46aeff992 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -272,7 +272,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o $ssl_state = (local_user() ? true : false); - $profile_owner = 0; $live_update_div = ''; $blocklist = conv_get_blocklist(); @@ -281,7 +280,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o if ($mode === 'network') { $items = conversation_add_children($items, false, $order, $uid); - $profile_owner = local_user(); if (!$update) { /* * The special div is needed for liveUpdate to kick in for this page. @@ -308,7 +306,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o } } elseif ($mode === 'profile') { $items = conversation_add_children($items, false, $order, $uid); - $profile_owner = $a->profile['uid']; if (!$update) { $tab = 'posts'; @@ -322,13 +319,12 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o */ $live_update_div = '
' . "\r\n" - . "\r\n"; } } } elseif ($mode === 'notes') { $items = conversation_add_children($items, false, $order, local_user()); - $profile_owner = local_user(); if (!$update) { $live_update_div = '
' . "\r\n" @@ -337,7 +333,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o } } elseif ($mode === 'display') { $items = conversation_add_children($items, false, $order, $uid); - $profile_owner = $a->profile['uid']; if (!$update) { $live_update_div = '
' . "\r\n" @@ -346,7 +341,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o } } elseif ($mode === 'community') { $items = conversation_add_children($items, true, $order, $uid); - $profile_owner = 0; if (!$update) { $live_update_div = '
' . "\r\n" @@ -357,7 +351,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o } } elseif ($mode === 'contacts') { $items = conversation_add_children($items, false, $order, $uid); - $profile_owner = 0; if (!$update) { $live_update_div = '
' . "\r\n" @@ -368,7 +361,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o $live_update_div = '' . "\r\n"; } - $page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false); + $page_dropping = ((local_user() && local_user() == $uid) ? true : false); if (!$update) { $_SESSION['return_path'] = DI::args()->getQueryString(); diff --git a/mod/display.php b/mod/display.php index 7a8bca4573..5bcf30faa0 100644 --- a/mod/display.php +++ b/mod/display.php @@ -21,7 +21,7 @@ use Friendica\App; use Friendica\Content\Text\BBCode; -use Friendica\Content\Text\HTML; +use Friendica\Content\Widget; use Friendica\Core\ACL; use Friendica\Core\Logger; use Friendica\Core\Protocol; @@ -32,8 +32,7 @@ use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Model\Post; -use Friendica\Model\Profile; -use Friendica\Module\Objects; +use Friendica\Module\ActivityPub\Objects; use Friendica\Network\HTTPException; use Friendica\Protocol\ActivityPub; use Friendica\Protocol\DFRN; @@ -126,7 +125,7 @@ function display_init(App $a) } } - Profile::load($a, $nick, $profiledata); + DI::page()['aside'] = Widget\VCard::getHTML($profiledata); } function display_fetchauthor($a, $item) @@ -257,6 +256,7 @@ function display_content(App $a, $update = false, $update_uid = 0) $is_remote_contact = false; $item_uid = local_user(); + $page_uid = 0; $parent = null; if (!empty($parent_uri_id)) { @@ -264,21 +264,21 @@ function display_content(App $a, $update = false, $update_uid = 0) } if (DBA::isResult($parent)) { - $a->profile['uid'] = ($a->profile['uid'] ?? 0) ?: $parent['uid']; - $is_remote_contact = Session::getRemoteContactID($a->profile['uid']); + $page_uid = ($page_uid ?? 0) ?: $parent['uid']; + $is_remote_contact = Session::getRemoteContactID($page_uid); if ($is_remote_contact) { $item_uid = $parent['uid']; } } else { - $a->profile = ['uid' => intval($item['uid'])]; + $page_uid = $item['uid']; } - $page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]); + $page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $page_uid]); if (DBA::isResult($page_contact)) { $a->page_contact = $page_contact; } - $is_owner = (local_user() && (in_array($a->profile['uid'], [local_user(), 0])) ? true : false); + $is_owner = (local_user() && (in_array($page_uid, [local_user(), 0])) ? true : false); if (!empty($a->profile['hidewall']) && !$is_owner && !$is_remote_contact) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.')); @@ -299,9 +299,9 @@ function display_content(App $a, $update = false, $update_uid = 0) ]; $o .= status_editor($a, $x, 0, true); } - $sql_extra = Item::getPermissionsSQLByUserId($a->profile['uid']); + $sql_extra = Item::getPermissionsSQLByUserId($page_uid); - if (local_user() && (local_user() == $a->profile['uid'])) { + if (local_user() && (local_user() == $page_uid)) { $condition = ['parent-uri-id' => $parent_uri_id, 'uid' => local_user(), 'unseen' => true]; $unseen = Post::exists($condition); } else { @@ -314,7 +314,7 @@ function display_content(App $a, $update = false, $update_uid = 0) $condition = ["`uri-id` = ? AND `uid` IN (0, ?) " . $sql_extra, $uri_id, $item_uid]; $fields = ['parent-uri-id', 'body', 'title', 'author-name', 'author-avatar', 'plink', 'author-id', 'owner-id', 'contact-id']; - $item = Post::selectFirstForUser($a->profile['uid'], $fields, $condition); + $item = Post::selectFirstForUser($page_uid, $fields, $condition); if (!DBA::isResult($item)) { throw new HTTPException\NotFoundException(DI::l10n()->t('The requested item doesn\'t exist or has been deleted.')); diff --git a/mod/follow.php b/mod/follow.php index ac74d217bc..86f7267126 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -20,6 +20,7 @@ */ use Friendica\App; +use Friendica\Content\Widget; use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\DI; @@ -75,7 +76,7 @@ function follow_content(App $a) // Don't try to add a pending contact $user_contact = DBA::selectFirst('contact', ['pending'], ["`uid` = ? AND ((`rel` != ?) OR (`network` = ?)) AND - (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?", + (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?", $uid, Contact::FOLLOWER, Protocol::DFRN, Strings::normaliseLink($url), Strings::normaliseLink($url), $url, Protocol::STATUSNET]); @@ -157,7 +158,7 @@ function follow_content(App $a) DI::page()['aside'] = ''; if ($protocol != Protocol::PHANTOM) { - Profile::load($a, '', $contact, false); + DI::page()['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false)); $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => DI::l10n()->t('Status Messages and Posts')] diff --git a/mod/unfollow.php b/mod/unfollow.php index 97cb0e1a32..f07522cab5 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -20,12 +20,12 @@ */ use Friendica\App; +use Friendica\Content\Widget; use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Model\Profile; use Friendica\Model\User; use Friendica\Util\Strings; @@ -105,7 +105,7 @@ function unfollow_content(App $a) ]); DI::page()['aside'] = ''; - Profile::load($a, '', Contact::getByURL($contact['url'], false)); + DI::page()['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false)); $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => DI::l10n()->t('Status Messages and Posts')]); diff --git a/src/Content/Widget/VCard.php b/src/Content/Widget/VCard.php new file mode 100644 index 0000000000..a7d7d8cbd2 --- /dev/null +++ b/src/Content/Widget/VCard.php @@ -0,0 +1,99 @@ +. + * + */ + +namespace Friendica\Content\Widget; + +use Friendica\Content\Text\BBCode; +use Friendica\Core\Protocol; +use Friendica\Core\Renderer; +use Friendica\DI; +use Friendica\Model\Contact; +use Friendica\Util\Strings; + +/** + * VCard widget + * + * @author Michael Vogel + */ +class VCard +{ + /** + * Get HTML for vcard block + * + * @template widget/vcard.tpl + * @return string + */ + public static function getHTML(array $contact) + { + if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) { + $network_link = Strings::formatNetworkName($contact['network'], $contact['url']); + } else { + $network_link = ''; + } + + $follow_link = ''; + $unfollow_link = ''; + $wallmessage_link = ''; + + if (local_user()) { + if ($contact['uid']) { + $id = $contact['id']; + $rel = $contact['rel']; + $pending = $contact['pending']; + } else { + $pcontact = Contact::selectFirst(['id', 'rel', 'pending'], ['uid' => local_user(), 'uri-id' => $contact['uri-id']]); + $id = $pcontact['id'] ?? 0; + $rel = $pcontact['rel'] ?? Contact::NOTHING; + $pending = $pcontact['pending'] ?? false; + } + + if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) { + if (in_array($rel, [Contact::SHARING, Contact::FRIEND])) { + $unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1'; + } elseif(!$pending) { + $follow_link = 'follow?url=' . urlencode($contact['url']) . '&auto=1'; + } + } + + if (in_array($rel, [Contact::FOLLOWER, Contact::FRIEND]) && Contact::canReceivePrivateMessages($contact)) { + $wallmessage_link = 'message/new/' . $id; + } + } + + return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [ + '$contact' => $contact, + '$photo' => Contact::getPhoto($contact), + '$url' => Contact::magicLinkByContact($contact, $contact['url']), + '$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'] ?? ''), + '$xmpp' => DI::l10n()->t('XMPP:'), + '$location' => DI::l10n()->t('Location:'), + '$network_link' => $network_link, + '$network' => DI::l10n()->t('Network:'), + '$account_type' => Contact::getAccountType($contact), + '$follow' => DI::l10n()->t('Follow'), + '$follow_link' => $follow_link, + '$unfollow' => DI::l10n()->t('Unfollow'), + '$unfollow_link' => $unfollow_link, + '$wallmessage' => DI::l10n()->t('Message'), + '$wallmessage_link' => $wallmessage_link, + ]); + } +} diff --git a/src/Model/Item.php b/src/Model/Item.php index 5a0c1066cb..cbac14a11b 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -468,18 +468,14 @@ class Item // Checking if there is already an item with the same guid $condition = ['guid' => $item['guid'], 'network' => $item['network'], 'uid' => $item['uid']]; if (Post::exists($condition)) { - Logger::notice('Found already existing item', [ - 'guid' => $item['guid'], - 'uid' => $item['uid'], - 'network' => $item['network'] - ]); + Logger::notice('Found already existing item', $condition); return true; } $condition = ['uri-id' => $item['uri-id'], 'uid' => $item['uid'], 'network' => [$item['network'], Protocol::DFRN]]; if (Post::exists($condition)) { - Logger::notice('duplicated item with the same uri found.', $item); + Logger::notice('duplicated item with the same uri found.', $condition); return true; } @@ -487,7 +483,7 @@ class Item if (in_array($item['network'], [Protocol::DFRN, Protocol::DIASPORA])) { $condition = ['guid' => $item['guid'], 'uid' => $item['uid']]; if (Post::exists($condition)) { - Logger::notice('duplicated item with the same guid found.', $item); + Logger::notice('duplicated item with the same guid found.', $condition); return true; } } elseif ($item['network'] == Protocol::OSTATUS) { diff --git a/src/Model/Profile.php b/src/Model/Profile.php index b3345eb63f..4ff34d4684 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -211,38 +211,12 @@ class Profile * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ - public static function load(App $a, $nickname, array $profiledata = [], $show_connect = true) + public static function load(App $a, $nickname) { - $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]); - - if (!DBA::isResult($user) && empty($profiledata)) { - Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG); - return; - } - - if (count($profiledata) > 0) { - // Ensure to have a "nickname" field - if (empty($profiledata['nickname']) && !empty($profiledata['nick'])) { - $profiledata['nickname'] = $profiledata['nick']; - } - - // Add profile data to sidebar - DI::page()['aside'] .= self::sidebar($a, $profiledata, true, $show_connect); - - if (!DBA::isResult($user)) { - return; - } - } - - $profile = !empty($user['uid']) ? User::getOwnerDataById($user['uid'], false) : []; - - if (empty($profile) && empty($profiledata)) { - Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG); - return; - } - + $profile = User::getOwnerDataByNick($nickname); if (empty($profile)) { - $profile = ['uid' => 0, 'name' => $nickname]; + Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG); + return; } $a->profile = $profile; @@ -253,7 +227,7 @@ class Profile DI::page()['title'] = $a->profile['name'] . ' @ ' . DI::config()->get('config', 'sitename'); - if (!$profiledata && !DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) { + if (!DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) { $a->setCurrentTheme($a->profile['theme']); $a->setCurrentMobileTheme($a->profile['mobile-theme']); } @@ -269,16 +243,14 @@ class Profile require_once $theme_info_file; } - $block = ((DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) ? true : false); + $block = (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()); /** * @todo * By now, the contact block isn't shown, when a different profile is given * But: When this profile was on the same server, then we could display the contacts */ - if (!$profiledata) { - DI::page()['aside'] .= self::sidebar($a, $a->profile, $block, $show_connect); - } + DI::page()['aside'] .= self::sidebar($a, $a->profile, $block); return; } @@ -304,7 +276,7 @@ class Profile * @hooks 'profile_sidebar' * array $arr */ - private static function sidebar(App $a, array $profile, $block = 0, $show_connect = true) + private static function sidebar(App $a, array $profile, $block = 0) { $o = ''; $location = false; @@ -374,7 +346,7 @@ class Profile || in_array($profile_contact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND]); $visitor_base_path = self::getMyURL() ? preg_replace('=/profile/(.*)=ism', '', self::getMyURL()) : ''; - if (!$local_user_is_self && $show_connect) { + if (!$local_user_is_self) { if (!$visitor_is_authenticated) { // Remote follow is only available for local profiles if (!empty($profile['nickname']) && strpos($profile_url, DI::baseUrl()->get()) === 0) { @@ -495,7 +467,7 @@ class Profile $p['photo'] = Contact::getAvatarUrlForId($cid, ProxyUtils::SIZE_SMALL); - $p['url'] = Contact::magicLinkById($cid); + $p['url'] = Contact::magicLinkById($cid, $profile['url']); $tpl = Renderer::getMarkupTemplate('profile/vcard.tpl'); $o .= Renderer::replaceMacros($tpl, [ diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 47f244a919..89051f27dc 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -308,42 +308,7 @@ class Contact extends BaseModule $a->data['contact'] = $contact; - if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) { - $network_link = Strings::formatNetworkName($contact['network'], $contact['url']); - } else { - $network_link = ''; - } - - $follow_link = ''; - $unfollow_link = ''; - if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) { - if ($contact['uid'] && in_array($contact['rel'], [Model\Contact::SHARING, Model\Contact::FRIEND])) { - $unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1'; - } elseif(!$contact['pending']) { - $follow_link = 'follow?url=' . urlencode($contact['url']) . '&auto=1'; - } - } - - $wallmessage_link = ''; - if ($contact['uid'] && Model\Contact::canReceivePrivateMessages($contact)) { - $wallmessage_link = 'message/new/' . $contact['id']; - } - - $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [ - '$name' => $contact['name'], - '$photo' => Model\Contact::getPhoto($contact), - '$url' => Model\Contact::magicLinkByContact($contact, $contact['url']), - '$addr' => $contact['addr'] ?? '', - '$network_link' => $network_link, - '$network' => DI::l10n()->t('Network:'), - '$account_type' => Model\Contact::getAccountType($contact), - '$follow' => DI::l10n()->t('Follow'), - '$follow_link' => $follow_link, - '$unfollow' => DI::l10n()->t('Unfollow'), - '$unfollow_link' => $unfollow_link, - '$wallmessage' => DI::l10n()->t('Message'), - '$wallmessage_link' => $wallmessage_link, - ]); + $vcard_widget = Widget\VCard::getHTML($contact); $findpeople_widget = ''; $follow_widget = ''; @@ -578,14 +543,14 @@ class Contact extends BaseModule Model\Contact::MIRROR_FORWARDED => DI::l10n()->t('Mirror as forwarded posting'), Model\Contact::MIRROR_OWN_POST => DI::l10n()->t('Mirror as my own posting')]; } elseif (in_array($contact['network'], [Protocol::ACTIVITYPUB])) { - $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'), + $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'), Model\Contact::MIRROR_NATIVE_RESHARE => DI::l10n()->t('Native reshare')]; } elseif (in_array($contact['network'], [Protocol::DFRN])) { - $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'), + $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'), Model\Contact::MIRROR_OWN_POST => DI::l10n()->t('Mirror as my own posting'), Model\Contact::MIRROR_NATIVE_RESHARE => DI::l10n()->t('Native reshare')]; } else { - $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'), + $remote_self_options = [Model\Contact::MIRROR_DEACTIVATED => DI::l10n()->t('No mirroring'), Model\Contact::MIRROR_OWN_POST => DI::l10n()->t('Mirror as my own posting')]; } @@ -669,7 +634,7 @@ class Contact extends BaseModule $contact['remote_self'], DI::l10n()->t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), $remote_self_options - ], + ], ]); $arr = ['contact' => $contact, 'output' => $o]; @@ -1002,11 +967,11 @@ class Contact extends BaseModule } if (DBA::isResult($contact)) { - DI::page()['aside'] = ''; - if (!$update) { $profiledata = Model\Contact::getByURLForUser($contact['url'], local_user()); - Model\Profile::load($a, '', $profiledata, true); + DI::page()['aside'] = Widget\VCard::getHTML($profiledata); + } else { + DI::page()['aside'] = ''; } if ($contact['uid'] == 0) { @@ -1026,15 +991,13 @@ class Contact extends BaseModule $o = self::getTabsHTML($contact, self::TAB_POSTS); if (DBA::isResult($contact)) { - DI::page()['aside'] = ''; - $profiledata = Model\Contact::getByURLForUser($contact['url'], local_user()); if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) { $profiledata['remoteconnect'] = DI::baseUrl() . '/follow?url=' . urlencode($profiledata['url']); } - Model\Profile::load($a, '', $profiledata, true); + DI::page()['aside'] = Widget\VCard::getHTML($profiledata); if ($contact['uid'] == 0) { $o .= Model\Contact::getPostsFromId($contact['id']); @@ -1115,7 +1078,7 @@ class Contact extends BaseModule 'alt_text' => $alt_text, 'name' => $contact['name'], 'nick' => $contact['nick'], - 'details' => $contact['location'], + 'details' => $contact['location'], 'tags' => $contact['keywords'], 'about' => $contact['about'], 'account_type' => Model\Contact::getAccountType($contact), diff --git a/src/Module/Contact/Advanced.php b/src/Module/Contact/Advanced.php index d287daed8f..29de7bd6fe 100644 --- a/src/Module/Contact/Advanced.php +++ b/src/Module/Contact/Advanced.php @@ -22,6 +22,7 @@ namespace Friendica\Module\Contact; use Friendica\BaseModule; +use Friendica\Content\Widget; use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Session; @@ -104,7 +105,7 @@ class Advanced extends BaseModule throw new BadRequestException(DI::l10n()->t('Contact not found.')); } - Model\Profile::load(DI::app(), "", Model\Contact::getByURL($contact["url"], false)); + DI::page()['aside'] = Widget\VCard::getHTML($contact); $warning = DI::l10n()->t('WARNING: This is highly advanced and if you enter incorrect information your communications with this contact may stop working.'); $info = DI::l10n()->t('Please use your browser \'Back\' button now if you are uncertain what to do on this page.'); diff --git a/src/Module/Contact/Contacts.php b/src/Module/Contact/Contacts.php index e38d7acfce..b75dea43db 100644 --- a/src/Module/Contact/Contacts.php +++ b/src/Module/Contact/Contacts.php @@ -38,7 +38,7 @@ class Contacts extends BaseModule $localContactId = Model\Contact::getPublicIdByUserId(local_user()); - Model\Profile::load($app, '', $contact); + DI::page()['aside'] = Widget\VCard::getHTML($contact); $condition = [ 'blocked' => false, diff --git a/src/Module/Contact/Poke.php b/src/Module/Contact/Poke.php index 96c0e3fea5..6e8920c5cf 100644 --- a/src/Module/Contact/Poke.php +++ b/src/Module/Contact/Poke.php @@ -3,6 +3,7 @@ namespace Friendica\Module\Contact; use Friendica\BaseModule; +use Friendica\Content\Widget; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; @@ -135,7 +136,7 @@ class Poke extends BaseModule throw new HTTPException\NotFoundException(); } - Model\Profile::load(DI::app(), '', Model\Contact::getByURL($contact["url"], false)); + DI::page()['aside'] = Widget\VCard::getHTML(Model\Contact::getByURL($contact["url"], false)); $verbs = []; foreach (DI::l10n()->getPokeVerbs() as $verb => $translations) { diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index c155e9e3d2..a1b77f8bd5 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -878,8 +878,8 @@ class Feed Protocol::OSTATUS, Protocol::DFRN, Protocol::DIASPORA]; if ($filter === 'comments') { - $condition[0] .= " AND `object-type` = ? "; - $condition[] = Activity\ObjectType::COMMENT; + $condition[0] .= " AND `gravity` = ? "; + $condition[] = GRAVITY_COMMENT; } if ($owner['account-type'] != User::ACCOUNT_TYPE_COMMUNITY) { diff --git a/src/Worker/UpdateContacts.php b/src/Worker/UpdateContacts.php index 0c211aa939..b5ac862bda 100644 --- a/src/Worker/UpdateContacts.php +++ b/src/Worker/UpdateContacts.php @@ -55,9 +55,9 @@ class UpdateContacts $ids = self::getContactsToUpdate($condition, [], $limit); Logger::info('Fetched federated user contacts', ['count' => count($ids)]); - $conditions = ["`id` IN (SELECT `author-id` FROM `post-user` WHERE `author-id` = `contact`.`id`)", - "`id` IN (SELECT `owner-id` FROM `post-user` WHERE `owner-id` = `contact`.`id`)", - "`id` IN (SELECT `causer-id` FROM `post-user` WHERE `causer-id` = `contact`.`id`)", + $conditions = ["`id` IN (SELECT `author-id` FROM `post` WHERE `author-id` = `contact`.`id`)", + "`id` IN (SELECT `owner-id` FROM `post` WHERE `owner-id` = `contact`.`id`)", + "`id` IN (SELECT `causer-id` FROM `post` WHERE `causer-id` = `contact`.`id`)", "`id` IN (SELECT `cid` FROM `post-tag` WHERE `cid` = `contact`.`id`)", "`id` IN (SELECT `cid` FROM `user-contact` WHERE `cid` = `contact`.`id`)"]; diff --git a/view/templates/widget/vcard.tpl b/view/templates/widget/vcard.tpl index 2cd8d9bb7b..4eedb9b7ac 100644 --- a/view/templates/widget/vcard.tpl +++ b/view/templates/widget/vcard.tpl @@ -1,14 +1,27 @@ -
-
{{$name}}
- {{if $addr}}
{{$addr}}
{{/if}} - {{if $about}}
{{$about nofilter}}
{{/if}} +
{{$contact.name}}
+ {{if $contact.addr}}
{{$contact.addr}}
{{/if}} {{if $url}}
{{$name}}
{{else}}
{{$name}}
{{/if}} {{if $account_type}}
{{$account_type}}
{{/if}} + {{if $about}}
{{$about nofilter}}
{{/if}} + {{if $contact.xmpp}} +
+
{{$xmpp}}
+
{{$contact.xmpp}}
+
+ {{/if}} + {{if $contact.location}} +
+
{{$location}}
+
+

{{$contact.location}}

+
+
+ {{/if}} {{if $network_link}}
{{$network}}
{{$network_link nofilter}}
{{/if}}