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

This commit is contained in:
Hypolite Petovan 2021-01-30 15:51:27 -05:00
parent 15e9f219e7
commit 7f78d6e722
5 changed files with 19 additions and 19 deletions

View file

@ -894,7 +894,7 @@ function item_photo_menu($item) {
$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']) {
$sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;'; $sub_link = 'javascript:doFollowThread(' . $item['id'] . '); return false;';
} }
$author = ['uid' => 0, 'id' => $item['author-id'], $author = ['uid' => 0, 'id' => $item['author-id'],

View file

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

View file

@ -174,7 +174,7 @@
{{* Put additional actions in a dropdown menu *}} {{* 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 role="presentation" class="separator"></span>
<span class="more-links btn-group{{if $item.thread_level > 1}} dropup{{/if}}"> <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> <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> </li>
{{/if}} {{/if}}
{{if $item.subthread}} {{if $item.follow_thread}}
<li role="menuitem"> <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> </li>
{{/if}} {{/if}}
@ -223,7 +223,7 @@
</li> </li>
{{/if}} {{/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> <li role="separator" class="divider"></li>
{{/if}} {{/if}}

View file

@ -326,7 +326,7 @@ as the value of $top_child_total (this is done at the end of this file)
{{/if}} {{/if}}
{{* Put additional actions in a dropdown menu *}} {{* 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 role="presentation" class="separator"></span>
<span class="more-links btn-group{{if $item.thread_level > 1}} dropup{{/if}}"> <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> <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> </li>
{{/if}} {{/if}}
{{if $item.subthread}} {{if $item.follow_thread}}
<li role="menuitem"> <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> </li>
{{/if}} {{/if}}
@ -375,7 +375,7 @@ as the value of $top_child_total (this is done at the end of this file)
</li> </li>
{{/if}} {{/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> <li role="separator" class="divider"></li>
{{/if}} {{/if}}
@ -492,7 +492,7 @@ as the value of $top_child_total (this is done at the end of this file)
</div> </div>
{{/if}} {{/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}}"> <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> <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}}"> <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> </li>
{{/if}} {{/if}}
{{if $item.subthread}} {{if $item.follow_thread}}
<li role="menuitem"> <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> </li>
{{/if}} {{/if}}

View file

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