Replace references of GET mod/substhread with POST item/{id}/follow

2022.09-rc
Hypolite Petovan 2021-01-30 15:51:27 -05:00
rodzic 15e9f219e7
commit 7f78d6e722
5 zmienionych plików z 19 dodań i 19 usunięć

Wyświetl plik

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

Wyświetl plik

@ -675,10 +675,10 @@ function doActivityItem(ident, verb, un) {
update_item = ident.toString();
}
function dosubthread(ident) {
function doFollowThread(ident) {
unpause();
$('#like-rotator-' + ident.toString()).show();
$.get('subthread/' + ident.toString(), NavUpdate);
$.post('item/' + ident.toString() + '/follow', NavUpdate);
liking = 1;
}

Wyświetl plik

@ -174,7 +174,7 @@
{{* Put additional actions in a dropdown menu *}}
{{if $item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.subthread || $item.ignore || $item.drop.dropping}}
{{if $item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.follow_thread || $item.ignore || $item.drop.dropping}}
<span role="presentation" class="separator"></span>
<span class="more-links btn-group{{if $item.thread_level > 1}} dropup{{/if}}">
<button type="button" class="btn-link dropdown-toggle" data-toggle="dropdown" id="dropdownMenuOptions-{{$item.id}}" aria-haspopup="true" aria-expanded="false" title="{{$item.menu}}"><i class="fa fa-ellipsis-h" aria-hidden="true"></i>&nbsp;{{$item.menu}}</button>
@ -211,9 +211,9 @@
</li>
{{/if}}
{{if $item.subthread}}
{{if $item.follow_thread}}
<li role="menuitem">
<a id="subthread-{{$item.id}}" href="javascript:{{$item.subthread.action}}" class="btn-link" title="{{$item.subthread.title}}"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;{{$item.subthread.title}}</a>
<a id="follow_thread-{{$item.id}}" href="javascript:{{$item.follow_thread.action}}" class="btn-link" title="{{$item.follow_thread.title}}"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;{{$item.follow_thread.title}}</a>
</li>
{{/if}}
@ -223,7 +223,7 @@
</li>
{{/if}}
{{if ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.subthread) && ($item.ignore || $item.drop.dropping)}}
{{if ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.follow_thread) && ($item.ignore || $item.drop.dropping)}}
<li role="separator" class="divider"></li>
{{/if}}

Wyświetl plik

@ -326,7 +326,7 @@ as the value of $top_child_total (this is done at the end of this file)
{{/if}}
{{* Put additional actions in a dropdown menu *}}
{{if $item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.subthread || $item.ignore || $item.drop.dropping}}
{{if $item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.follow_thread || $item.ignore || $item.drop.dropping}}
<span role="presentation" class="separator"></span>
<span class="more-links btn-group{{if $item.thread_level > 1}} dropup{{/if}}">
<button type="button" class="btn-link dropdown-toggle" data-toggle="dropdown" id="dropdownMenuOptions-{{$item.id}}" aria-haspopup="true" aria-expanded="false" title="{{$item.menu}}"><i class="fa fa-ellipsis-h" aria-hidden="true"></i>&nbsp;{{$item.menu}}</button>
@ -363,9 +363,9 @@ as the value of $top_child_total (this is done at the end of this file)
</li>
{{/if}}
{{if $item.subthread}}
{{if $item.follow_thread}}
<li role="menuitem">
<a id="subthread-{{$item.id}}" href="javascript:{{$item.subthread.action}}" class="btn-link" title="{{$item.subthread.title}}"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;{{$item.subthread.title}}</a>
<a id="follow_thread-{{$item.id}}" href="javascript:{{$item.follow_thread.action}}" class="btn-link" title="{{$item.follow_thread.title}}"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;{{$item.follow_thread.title}}</a>
</li>
{{/if}}
@ -375,7 +375,7 @@ as the value of $top_child_total (this is done at the end of this file)
</li>
{{/if}}
{{if ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.subthread) && ($item.ignore || $item.drop.dropping)}}
{{if ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.follow_thread) && ($item.ignore || $item.drop.dropping)}}
<li role="separator" class="divider"></li>
{{/if}}
@ -492,7 +492,7 @@ as the value of $top_child_total (this is done at the end of this file)
</div>
{{/if}}
{{if $item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.subthread || $item.ignore || $item.drop.dropping}}
{{if $item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.follow_thread || $item.ignore || $item.drop.dropping}}
<div class="more-links btn-group{{if $item.thread_level > 1}} dropup{{/if}}">
<button type="button" class="btn btn-sm dropdown-toggle" data-toggle="dropdown" id="dropdownMenuOptions-{{$item.id}}" aria-haspopup="true" aria-expanded="false" title="{{$item.menu}}"><i class="fa fa-ellipsis-h" aria-hidden="true"></i></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="dropdownMenuOptions-{{$item.id}}">
@ -528,9 +528,9 @@ as the value of $top_child_total (this is done at the end of this file)
</li>
{{/if}}
{{if $item.subthread}}
{{if $item.follow_thread}}
<li role="menuitem">
<a id="subthread-{{$item.id}}" href="javascript:{{$item.subthread.action}}" class="btn-link" title="{{$item.subthread.title}}"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;{{$item.subthread.title}}</a>
<a id="follow_thread-{{$item.id}}" href="javascript:{{$item.follow_thread.action}}" class="btn-link" title="{{$item.follow_thread.title}}"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;{{$item.follow_thread.title}}</a>
</li>
{{/if}}

Wyświetl plik

@ -308,20 +308,20 @@ function frio_acl_lookup(App $a, &$results)
*/
function frio_display_item(App $a, &$arr)
{
// Add subthread to the item menu
$subthread = [];
// Add follow to the item menu
$followThread = [];
if (
local_user()
&& local_user() == $arr['item']['uid']
&& $arr['item']['gravity'] == GRAVITY_PARENT
&& !$arr['item']['self'])
{
$subthread = [
$followThread = [
'menu' => 'follow_thread',
'title' => DI::l10n()->t('Follow Thread'),
'action' => 'dosubthread(' . $arr['item']['id'] . ');',
'action' => 'doFollowThread(' . $arr['item']['id'] . ');',
'href' => '#'
];
}
$arr['output']['subthread'] = $subthread;
$arr['output']['follow_thread'] = $followThread;
}