Merge pull request #9967 from annando/follow

Offer "follow thread" only when you don't already follow
This commit is contained in:
Hypolite Petovan 2021-02-28 07:45:02 -05:00 committed by GitHub
commit c8b97a6fe5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 12 deletions

View file

@ -899,7 +899,7 @@ function item_photo_menu($item) {
$block_link = ''; $block_link = '';
$ignore_link = ''; $ignore_link = '';
if (local_user() && local_user() == $item['uid'] && $item['gravity'] == GRAVITY_PARENT && !$item['self']) { if (local_user() && local_user() == $item['uid'] && $item['gravity'] == GRAVITY_PARENT && !$item['self'] && !$item['mention']) {
$sub_link = 'javascript:doFollowThread(' . $item['id'] . '); return false;'; $sub_link = 'javascript:doFollowThread(' . $item['id'] . '); return false;';
} }

View file

@ -76,7 +76,7 @@ class Item
'commented', 'created', 'edited', 'received', 'verb', 'object-type', 'postopts', 'plink', 'commented', 'created', 'edited', 'received', 'verb', 'object-type', 'postopts', 'plink',
'wall', 'private', 'starred', 'origin', 'parent-origin', 'title', 'body', 'language', 'wall', 'private', 'starred', 'origin', 'parent-origin', 'title', 'body', 'language',
'content-warning', 'location', 'coord', 'app', 'rendered-hash', 'rendered-html', 'object', 'content-warning', 'location', 'coord', 'app', 'rendered-hash', 'rendered-html', 'object',
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'mention',
'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network', 'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network',
'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type', 'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type',
'causer-id', 'causer-link', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network', 'causer-id', 'causer-link', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network',

View file

@ -300,14 +300,16 @@ class Post
if ($this->isToplevel()) { if ($this->isToplevel()) {
if(local_user()) { if(local_user()) {
$ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], local_user()); $ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], local_user());
$ignore = [ if ($item['mention'] || $ignored) {
'do' => DI::l10n()->t("ignore thread"), $ignore = [
'undo' => DI::l10n()->t("unignore thread"), 'do' => DI::l10n()->t("ignore thread"),
'toggle' => DI::l10n()->t("toggle ignore status"), 'undo' => DI::l10n()->t("unignore thread"),
'classdo' => $ignored ? "hidden" : "", 'toggle' => DI::l10n()->t("toggle ignore status"),
'classundo' => $ignored ? "" : "hidden", 'classdo' => $ignored ? "hidden" : "",
'ignored' => DI::l10n()->t('ignored'), 'classundo' => $ignored ? "" : "hidden",
]; 'ignored' => DI::l10n()->t('ignored'),
];
}
if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) { if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) {
if ($origin) { if ($origin) {

View file

@ -314,8 +314,9 @@ function frio_display_item(App $a, &$arr)
local_user() local_user()
&& local_user() == $arr['item']['uid'] && local_user() == $arr['item']['uid']
&& $arr['item']['gravity'] == GRAVITY_PARENT && $arr['item']['gravity'] == GRAVITY_PARENT
&& !$arr['item']['self']) && !$arr['item']['self']
{ && !$arr['item']['mention']
) {
$followThread = [ $followThread = [
'menu' => 'follow_thread', 'menu' => 'follow_thread',
'title' => DI::l10n()->t('Follow Thread'), 'title' => DI::l10n()->t('Follow Thread'),