diff --git a/include/conversation.php b/include/conversation.php index b8cdd7a06..6ce200498 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -418,7 +418,6 @@ These Fields are not added below (yet). They are here to for bug search. `item`.`inform`, `item`.`pubmail`, `item`.`visible`, -`item`.`spam`, `item`.`bookmark`, `item`.`unseen`, `item`.`deleted`, @@ -426,10 +425,12 @@ These Fields are not added below (yet). They are here to for bug search. `item`.`mention`, `item`.`global`, `item`.`shadow`, + `item`.`author-link`, `item`.`author-name`, `item`.`author-avatar`, + `item`.`owner-link`, `item`.`owner-name`, `item`.`owner-avatar`, */ - return "`item`.`author-id`, `item`.`author-link`, `item`.`author-name`, `item`.`author-avatar`, - `item`.`owner-id`, `item`.`owner-link`, `item`.`owner-name`, `item`.`owner-avatar`, + return "`item`.`author-id`, + `item`.`owner-id`, `item`.`contact-id`, `item`.`uid`, `item`.`id`, `item`.`parent`, `item`.`uri`, `item`.`thr-parent`, `item`.`parent-uri`, `item`.`content-warning`, `item`.`commented`, `item`.`created`, `item`.`edited`, `item`.`received`, @@ -441,7 +442,9 @@ These Fields are not added below (yet). They are here to for bug search. `item`.`allow_cid`, `item`.`allow_gid`, `item`.`deny_cid`, `item`.`deny_gid`, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, - `author`.`thumb` AS `author-thumb`, `owner`.`thumb` AS `owner-thumb`, + `author`.`url` AS `author-link`, `author`.`name` AS `author-name`, `author`.`thumb` AS `author-avatar`, + `owner`.`url` AS `owner-link`, `owner`.`name` AS `owner-name`, `owner`.`thumb` AS `owner-avatar`, + `contact`.`url` AS `contact-link`, `contact`.`name` AS `contact-name`, `contact`.`thumb` AS `contact-avatar`, `contact`.`network`, `contact`.`url`, `contact`.`name`, `contact`.`writable`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`alias`, @@ -532,7 +535,6 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order = . ((x($_GET, 'bmark')) ? '&bmark=' . $_GET['bmark'] : '') . ((x($_GET, 'liked')) ? '&liked=' . $_GET['liked'] : '') . ((x($_GET, 'conv')) ? '&conv=' . $_GET['conv'] : '') - . ((x($_GET, 'spam')) ? '&spam=' . $_GET['spam'] : '') . ((x($_GET, 'nets')) ? '&nets=' . $_GET['nets'] : '') . ((x($_GET, 'cmin')) ? '&cmin=' . $_GET['cmin'] : '') . ((x($_GET, 'cmax')) ? '&cmax=' . $_GET['cmax'] : '') @@ -658,6 +660,13 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order = continue; } + if ($item['network'] == NETWORK_FEED) { + $item['author-avatar'] = $item['contact-avatar']; + $item['author-name'] = $item['contact-name']; + $item['owner-avatar'] = $item['contact-avatar']; + $item['owner-name'] = $item['contact-name']; + } + $profile_name = (strlen($item['author-name']) ? $item['author-name'] : $item['name']); if ($item['author-link'] && !$item['author-name']) { $profile_name = $item['author-link']; @@ -671,24 +680,6 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order = $sparkle = ' sparkle'; } - if (!x($item, 'author-thumb') || ($item['author-thumb'] == "")) { - $author_contact = Contact::getDetailsByURL($item['author-link'], $profile_owner); - if ($author_contact["thumb"]) { - $item['author-thumb'] = $author_contact["thumb"]; - } else { - $item['author-thumb'] = $item['author-avatar']; - } - } - - if (!isset($item['owner-thumb']) || ($item['owner-thumb'] == "")) { - $owner_contact = Contact::getDetailsByURL($item['owner-link'], $profile_owner); - if ($owner_contact["thumb"]) { - $item['owner-thumb'] = $owner_contact["thumb"]; - } else { - $item['owner-thumb'] = $item['owner-avatar']; - } - } - $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => '']; Addon::callHooks('render_location',$locate); @@ -749,7 +740,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order = 'name' => $profile_name_e, 'sparkle' => $sparkle, 'lock' => $lock, - 'thumb' => System::removedBaseUrl(proxy_url($item['author-thumb'], false, PROXY_SIZE_THUMB)), + 'thumb' => System::removedBaseUrl(proxy_url($item['author-avatar'], false, PROXY_SIZE_THUMB)), 'title' => $title_e, 'body' => $body_e, 'tags' => $tags_e, @@ -768,7 +759,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order = 'indent' => '', 'owner_name' => $owner_name_e, 'owner_url' => $owner_url, - 'owner_photo' => System::removedBaseUrl(proxy_url($item['owner-thumb'], false, PROXY_SIZE_THUMB)), + 'owner_photo' => System::removedBaseUrl(proxy_url($item['owner-avatar'], false, PROXY_SIZE_THUMB)), 'plink' => get_plink($item), 'edpost' => false, 'isstarred' => $isstarred, diff --git a/include/enotify.php b/include/enotify.php index 39c74fdc6..257c10720 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -152,7 +152,7 @@ function notification($params) } // "your post" - if (DBM::is_result($item) && $item['owner-name'] == $item['author-name'] && $item['wall']) { + if (DBM::is_result($item) && $item['owner-id'] == $item['author-id'] && $item['wall']) { $dest_str = L10n::t('%1$s commented on [url=%2$s]your %3$s[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]', $itemlink, diff --git a/mod/admin.php b/mod/admin.php index 81c65859c..8e7dfc1f4 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -928,7 +928,7 @@ function admin_page_site_post(App $a) update_table("term", ['url'], $old_url, $new_url); update_table("contact", ['photo', 'thumb', 'micro', 'url', 'nurl', 'alias', 'request', 'notify', 'poll', 'confirm', 'poco', 'avatar'], $old_url, $new_url); update_table("gcontact", ['url', 'nurl', 'photo', 'server_url', 'notify', 'alias'], $old_url, $new_url); - update_table("item", ['owner-link', 'owner-avatar', 'author-link', 'author-avatar', 'body', 'plink', 'tag'], $old_url, $new_url); + update_table("item", ['owner-link', 'author-link', 'body', 'plink', 'tag'], $old_url, $new_url); // update profile addresses in the format "user@server.tld" update_table("contact", ['addr'], $old_host, $new_host); diff --git a/mod/display.php b/mod/display.php index 6286569a5..6380e6f6c 100644 --- a/mod/display.php +++ b/mod/display.php @@ -49,8 +49,7 @@ function display_init(App $a) // Does the local user have this item? if (local_user()) { - $r = dba::fetch_first("SELECT `id`, `parent`, `author-name`, `author-link`, - `author-avatar`, `network`, `body`, `uid`, `owner-link` + $r = dba::fetch_first("SELECT `id`, `parent`, `author-id`, `body`, `uid` FROM `item` WHERE `visible` AND NOT `deleted` AND NOT `moderated` AND `guid` = ? AND `uid` = ? LIMIT 1", $a->argv[1], local_user()); if (DBM::is_result($r)) { @@ -60,8 +59,7 @@ function display_init(App $a) // Is it an item with uid=0? if (!DBM::is_result($r)) { - $r = dba::fetch_first("SELECT `id`, `parent`, `author-name`, `author-link`, - `author-avatar`, `network`, `body`, `uid`, `owner-link` + $r = dba::fetch_first("SELECT `id`, `parent`, `author-id`, `body`, `uid` FROM `item` WHERE `visible` AND NOT `deleted` AND NOT `moderated` AND NOT `private` AND `uid` = 0 AND `guid` = ? LIMIT 1", $a->argv[1]); @@ -73,8 +71,7 @@ function display_init(App $a) return; } } elseif (($a->argc == 3) && ($nick == 'feed-item')) { - $r = dba::fetch_first("SELECT `id`, `parent`, `author-name`, `author-link`, - `author-avatar`, `network`, `body`, `uid`, `owner-link` + $r = dba::fetch_first("SELECT `id`, `parent`, `author-id`, `body`, `uid` FROM `item` WHERE `visible` AND NOT `deleted` AND NOT `moderated` AND NOT `private` AND `uid` = 0 AND `id` = ? LIMIT 1", $a->argv[2]); @@ -87,7 +84,7 @@ function display_init(App $a) } if ($r["id"] != $r["parent"]) { - $r = dba::fetch_first("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item` + $r = dba::fetch_first("SELECT `id`, `author-id`, `body`, `uid` FROM `item` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` AND `id` = ?", $r["parent"]); } @@ -117,14 +114,16 @@ function display_init(App $a) } function display_fetchauthor($a, $item) { + $author = dba::selectFirst('contact', ['name', 'nick', 'photo', 'network', 'url'], ['id' => $item['author-id']]); + $profiledata = []; - $profiledata["uid"] = -1; - $profiledata["nickname"] = $item["author-name"]; - $profiledata["name"] = $item["author-name"]; - $profiledata["picdate"] = ""; - $profiledata["photo"] = $item["author-avatar"]; - $profiledata["url"] = $item["author-link"]; - $profiledata["network"] = $item["network"]; + $profiledata['uid'] = -1; + $profiledata['nickname'] = $author['nick']; + $profiledata['name'] = $author['name']; + $profiledata['picdate'] = ''; + $profiledata['photo'] = $author['photo']; + $profiledata['url'] = $author['url']; + $profiledata['network'] = $author['network']; // Check for a repeated message $skip = false; diff --git a/mod/network.php b/mod/network.php index 23835c8d5..d1a282636 100644 --- a/mod/network.php +++ b/mod/network.php @@ -103,7 +103,6 @@ function network_init(App $a) '/new', //new '', //starred '', //bookmarked - '', //spam ]; $tab_args = [ 'f=&order=comment', //all @@ -112,7 +111,6 @@ function network_init(App $a) '', //new 'f=&star=1', //starred 'f=&bmark=1', //bookmarked - 'f=&spam=1', //spam ]; $k = array_search('active', $last_sel_tabs); @@ -218,9 +216,8 @@ function saved_searches($search) * '/network/new', => $new_active = 'active' * '/network?f=&star=1', => $starred_active = 'active' * '/network?f=&bmark=1', => $bookmarked_active = 'active' - * '/network?f=&spam=1', => $spam_active = 'active' * - * @return Array ($no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active); + * @return Array ($no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active); */ function network_query_get_sel_tab(App $a) { @@ -230,7 +227,6 @@ function network_query_get_sel_tab(App $a) $bookmarked_active = ''; $all_active = ''; $conv_active = ''; - $spam_active = ''; $postord_active = ''; if (($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new')) { @@ -249,11 +245,7 @@ function network_query_get_sel_tab(App $a) $conv_active = 'active'; } - if (x($_GET, 'spam')) { - $spam_active = 'active'; - } - - if (($new_active == '') && ($starred_active == '') && ($bookmarked_active == '') && ($conv_active == '') && ($spam_active == '')) { + if (($new_active == '') && ($starred_active == '') && ($bookmarked_active == '') && ($conv_active == '')) { $no_active = 'active'; } @@ -264,7 +256,7 @@ function network_query_get_sel_tab(App $a) } } - return [$no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active]; + return [$no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active]; } function network_query_get_sel_group(App $a) @@ -928,7 +920,7 @@ function network_tabs(App $a) // item filter tabs /// @TODO fix this logic, reduce duplication /// $a->page['content'] .= '