]> git.mxchange.org Git - friendica.git/commitdiff
Make "like" links one way
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 27 May 2020 12:40:00 +0000 (08:40 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 27 May 2020 12:41:13 +0000 (08:41 -0400)
- Updated dolike() function to accept a "un-" switch
- [frio] Updated doLikeAction() function to call dolike() instead of having duplicated code
- Added boolean logic (with explanatory truth table) to smartly delete existing activities in Model\Item::performActivity
- Moved verb/activity parameter handling closer to their use in Model\Item::performActivity
- Updated all references to dolike() and doLikeAction() to include the "un-" switch

13 files changed:
src/Model/Item.php
view/js/main.js
view/templates/wall_thread.tpl
view/theme/frio/js/theme.js
view/theme/frio/templates/search_item.tpl
view/theme/frio/templates/wall_thread.tpl
view/theme/quattro/templates/photo_item.tpl
view/theme/quattro/templates/search_item.tpl
view/theme/quattro/templates/wall_thread.tpl
view/theme/smoothly/templates/wall_thread.tpl
view/theme/vier/templates/photo_item.tpl
view/theme/vier/templates/search_item.tpl
view/theme/vier/templates/wall_thread.tpl

index 6b48acf4cbfa2437df93ba88a5e17d5f1fa7c608..081babd996fed0ed52d1bdbb7b7460a71e971e59 100644 (file)
@@ -2946,39 +2946,6 @@ class Item
                        return false;
                }
 
-               switch ($verb) {
-                       case 'like':
-                       case 'unlike':
-                               $activity = Activity::LIKE;
-                               break;
-                       case 'dislike':
-                       case 'undislike':
-                               $activity = Activity::DISLIKE;
-                               break;
-                       case 'attendyes':
-                       case 'unattendyes':
-                               $activity = Activity::ATTEND;
-                               break;
-                       case 'attendno':
-                       case 'unattendno':
-                               $activity = Activity::ATTENDNO;
-                               break;
-                       case 'attendmaybe':
-                       case 'unattendmaybe':
-                               $activity = Activity::ATTENDMAYBE;
-                               break;
-                       case 'follow':
-                       case 'unfollow':
-                               $activity = Activity::FOLLOW;
-                               break;
-                       default:
-                               Logger::log('like: unknown verb ' . $verb . ' for item ' . $item_id);
-                               return false;
-               }
-
-               // Enable activity toggling instead of on/off
-               $event_verb_flag = $activity === Activity::ATTEND || $activity === Activity::ATTENDNO || $activity === Activity::ATTENDMAYBE;
-
                Logger::log('like: verb ' . $verb . ' item ' . $item_id);
 
                $item = self::selectFirst(self::ITEM_FIELDLIST, ['`id` = ? OR `uri` = ?', $item_id, $item_id]);
@@ -3027,9 +2994,43 @@ class Item
                        }
                }
 
+               switch ($verb) {
+                       case 'like':
+                       case 'unlike':
+                               $activity = Activity::LIKE;
+                               break;
+                       case 'dislike':
+                       case 'undislike':
+                               $activity = Activity::DISLIKE;
+                               break;
+                       case 'attendyes':
+                       case 'unattendyes':
+                               $activity = Activity::ATTEND;
+                               break;
+                       case 'attendno':
+                       case 'unattendno':
+                               $activity = Activity::ATTENDNO;
+                               break;
+                       case 'attendmaybe':
+                       case 'unattendmaybe':
+                               $activity = Activity::ATTENDMAYBE;
+                               break;
+                       case 'follow':
+                       case 'unfollow':
+                               $activity = Activity::FOLLOW;
+                               break;
+                       default:
+                               Logger::log('like: unknown verb ' . $verb . ' for item ' . $item_id);
+                               return false;
+               }
+
+               $mode = Strings::startsWith($verb, 'un') ? 'delete' : 'create';
+
+               // Enable activity toggling instead of on/off
+               $event_verb_flag = $activity === Activity::ATTEND || $activity === Activity::ATTENDNO || $activity === Activity::ATTENDMAYBE;
+
                // Look for an existing verb row
-               // event participation are essentially radio toggles. If you make a subsequent choice,
-               // we need to eradicate your first choice.
+               // Event participation activities are mutually exclusive, only one of them can exist at all times.
                if ($event_verb_flag) {
                        $verbs = [Activity::ATTEND, Activity::ATTENDNO, Activity::ATTENDMAYBE];
 
@@ -3044,20 +3045,43 @@ class Item
 
                $condition = ['vid' => $vids, 'deleted' => false, 'gravity' => GRAVITY_ACTIVITY,
                        'author-id' => $author_id, 'uid' => $item['uid'], 'thr-parent' => $item_uri];
-
                $like_item = self::selectFirst(['id', 'guid', 'verb'], $condition);
 
-               // If it exists, mark it as deleted
                if (DBA::isResult($like_item)) {
-                       self::markForDeletionById($like_item['id']);
+                       /**
+                        * Truth table for existing activities
+                        *
+                        * |          Inputs            ||      Outputs      |
+                        * |----------------------------||-------------------|
+                        * |  Mode  | Event | Same verb || Delete? | Return? |
+                        * |--------|-------|-----------||---------|---------|
+                        * | create |  Yes  |    Yes    ||   No    |   Yes   |
+                        * | create |  Yes  |    No     ||   Yes   |   No    |
+                        * | create |  No   |    Yes    ||   No    |   Yes   |
+                        * | create |  No   |    No     ||        N/A†       |
+                        * | delete |  Yes  |    Yes    ||   Yes   |   N/A‡  |
+                        * | delete |  Yes  |    No     ||   No    |   N/A‡  |
+                        * | delete |  No   |    Yes    ||   Yes   |   N/A‡  |
+                        * | delete |  No   |    No     ||        N/A†       |
+                        * |--------|-------|-----------||---------|---------|
+                        * |   A    |   B   |     C     || A xor C | !B or C |
+                        *
+                        * † Can't happen: It's impossible to find an existing non-event activity without
+                        *                 the same verb because we are only looking for this single verb.
+                        *
+                        * ‡ The "mode = delete" is returning early whether an existing activity was found or not.
+                        */
+                       if ($mode == 'create' xor $like_item['verb'] == $activity) {
+                               self::markForDeletionById($like_item['id']);
+                       }
 
                        if (!$event_verb_flag || $like_item['verb'] == $activity) {
                                return true;
                        }
                }
 
-               // Verb is "un-something", just trying to delete existing entries
-               if (strpos($verb, 'un') === 0) {
+               // No need to go further if we aren't creating anything
+               if ($mode == 'delete') {
                        return true;
                }
 
index af2f8522c8e76341b360447b3b3688480a631225..60337918b4ecd3addb4e4fcdf0dd5382a03df3c3 100644 (file)
@@ -649,9 +649,15 @@ function imgdull(node) {
 // trickery. This still could cause confusion if the "like" ajax call
 // is delayed and NavUpdate runs before it completes.
 
-function dolike(ident,verb) {
+/**
+ * @param {int}     ident The id of the relevant item
+ * @param {string}  verb  The verb of the action
+ * @param {boolean} un    Whether to perform an activity removal instead of creation
+ */
+function dolike(ident, verb, un) {
        unpause();
        $('#like-rotator-' + ident.toString()).show();
+       verb = un ? 'un' + verb : verb;
        $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate);
        liking = 1;
        force_update = true;
index 7b205504d46187651498798ac2686f9ae778ca87..0d8c896e164d63610ce99b103d8609b9da0f2860 100644 (file)
@@ -77,8 +77,8 @@
                <div class="wall-item-tools" id="wall-item-tools-{{$item.id}}">
                        {{if $item.vote}}
                        <div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$item.id}}">
-                               <a href="#" class="icon like{{if $item.responses.like.self}} active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false"></a>
-                               {{if $item.vote.dislike}}<a href="#" class="icon dislike{{if $item.responses.dislike.self}} active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false"></a>{{/if}}
+                               <a href="#" class="icon like{{if $item.responses.like.self}} active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false"></a>
+                               {{if $item.vote.dislike}}<a href="#" class="icon dislike{{if $item.responses.dislike.self}} active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false"></a>{{/if}}
                                {{if $item.vote.share}}<a href="#" class="icon recycle wall-item-share-buttons" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false"></a>{{/if}}
                                <img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
                        </div>
                        {{/if}}
                        {{if $item.isevent }}
                        <div class="wall-item-attend-wrapper">
-                               <a href="#" id="attendyes-{{$item.id}}" class="icon attendyes{{if $item.responses.attendyes.self}} active{{/if}}" onclick="dolike({{$item.id}},'attendyes'); return false;" title="{{$item.attend.0}}"></a>
-                               <a href="#" id="attendno-{{$item.id}}" class="icon attendno{{if $item.responses.attendno.self}} active{{/if}}"  onclick="dolike({{$item.id}},'attendno'); return false;" title="{{$item.attend.1}}"></a>
-                               <a href="#" id="attendmaybe-{{$item.id}}"  class="icon attendmaybe{{if $item.responses.attendmaybe.self}} active{{/if}}" onclick="dolike({{$item.id}},'attendmaybe'); return false;" title="{{$item.attend.2}}"></a>
+                               <a href="#" id="attendyes-{{$item.id}}" class="icon attendyes{{if $item.responses.attendyes.self}} active{{/if}}" onclick="dolike({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}}); return false;" title="{{$item.attend.0}}"></a>
+                               <a href="#" id="attendno-{{$item.id}}" class="icon attendno{{if $item.responses.attendno.self}} active{{/if}}"  onclick="dolike({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}}); return false;" title="{{$item.attend.1}}"></a>
+                               <a href="#" id="attendmaybe-{{$item.id}}"  class="icon attendmaybe{{if $item.responses.attendmaybe.self}} active{{/if}}" onclick="dolike({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}}); return false;" title="{{$item.attend.2}}"></a>
                        </div>
                        {{/if}}
                        <div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-{{$item.id}}" >
index 3a3f02c5e5f239ac379592bbff86be1de5953d5e..6b85e610e9f3b69ae5415f79551ee28635f04de0 100644 (file)
@@ -721,22 +721,17 @@ function htmlToText(htmlString) {
  * Sends a /like API call and updates the display of the relevant action button
  * before the update reloads the item.
  *
- * @param {string} ident The id of the relevant item
- * @param {string} verb The verb of the action
- * @returns {undefined}
+ * @param {int}     ident The id of the relevant item
+ * @param {string}  verb  The verb of the action
+ * @param {boolean} un    Whether to perform an activity removal instead of creation
  */
-function doLikeAction(ident, verb) {
-       unpause();
-
+function doLikeAction(ident, verb, un) {
        if (verb.indexOf('attend') === 0) {
                $('.item-' + ident + ' .button-event:not(#' + verb + '-' + ident + ')').removeClass('active');
        }
        $('#' + verb + '-' + ident).toggleClass('active');
-       $('#like-rotator-' + ident.toString()).show();
-       $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
-       liking = 1;
-       force_update = true;
-       update_item = ident.toString();
+
+       dolike(ident, verb, un);
 }
 
 // Decodes a hexadecimally encoded binary string
index 1cbd8451d45f434605684343e18d0b51cd6be9d5..ce5497dda51eeded613fda6271b8ee25ca010695 100644 (file)
                                        {{* Buttons for like and dislike *}}
                                        {{if $item.vote}}
                                                {{if $item.vote.like}}
-                                       <button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}}, 'like');">{{$item.vote.like.0}}</button>
+                                       <button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}});">{{$item.vote.like.0}}</button>
                                                {{/if}}
                                                {{if $item.vote.like AND $item.vote.dislike}}
                                        <span role="presentation" class="separator">•</span>
                                                {{/if}}
 
                                                {{if $item.vote.dislike}}
-                                       <button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}}, 'dislike');">{{$item.vote.dislike.0}}</button>
+                                       <button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}});">{{$item.vote.dislike.0}}</button>
                                                {{/if}}
                                                {{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}}
                                        <span role="presentation" class="separator">•</span>
                                        {{* Event attendance buttons *}}
                                {{if $item.isevent}}
                                        <span class="vote-event">
-                                               <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}}, 'attendyes');"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
-                                               <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}}, 'attendno');"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
-                                               <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}}, 'attendmaybe');"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
+                                               <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}});"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
+                                               <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}});"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
+                                               <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}});"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
                                        </span>
                                {{/if}}
 
index a5a785af7eaf1c466664a4834cc9394dac616c94..c15b110ec9b91c9d98824e8b0e311c12b19ce24a 100644 (file)
@@ -282,13 +282,13 @@ as the value of $top_child_total (this is done at the end of this file)
                        {{* Buttons for like and dislike *}}
                        {{if $item.vote}}
                                {{if $item.vote.like}}
-                               <button type="button" class="btn-link button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}},'like');" data-toggle="button"><i class="fa fa-thumbs-up" aria-hidden="true"></i>&nbsp;{{$item.vote.like.1}}</button>
+                               <button type="button" class="btn-link button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-up" aria-hidden="true"></i>&nbsp;{{$item.vote.like.1}}</button>
                                {{/if}}
                                {{if $item.vote.like AND $item.vote.dislike}}
                                <span role="presentation" class="separator"></span>
                                {{/if}}
                                {{if $item.vote.dislike}}
-                               <button type="button" class="btn-link button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}},'dislike');" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i>&nbsp;{{$item.vote.dislike.1}}</button>
+                               <button type="button" class="btn-link button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i>&nbsp;{{$item.vote.dislike.1}}</button>
                                {{/if}}
 
                                {{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}}
@@ -390,9 +390,9 @@ as the value of $top_child_total (this is done at the end of this file)
                                {{* Event attendance buttons *}}
                        {{if $item.isevent}}
                                <span class="vote-event">
-                                       <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}},'attendyes');"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
-                                       <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}},'attendno');"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
-                                       <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}},'attendmaybe');"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
+                                       <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}});"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
+                                       <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}});"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
+                                       <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}});"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
                                </span>
                        {{/if}}
 
@@ -409,10 +409,10 @@ as the value of $top_child_total (this is done at the end of this file)
                        {{if $item.vote}}
                                <div class="btn-group" role="group">
                                {{if $item.vote.like}}
-                                       <button type="button" class="btn btn-sm button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}},'like');" data-toggle="button""><i class="fa fa-thumbs-up" aria-hidden="true"></i></button>
+                                       <button type="button" class="btn btn-sm button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-up" aria-hidden="true"></i></button>
                                {{/if}}
                                {{if $item.vote.dislike}}
-                                       <button type="button" class="btn btn-sm button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}},'dislike');" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i></button>
+                                       <button type="button" class="btn btn-sm button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i></button>
                                {{/if}}
                                </div>
                        {{/if}}
@@ -441,9 +441,9 @@ as the value of $top_child_total (this is done at the end of this file)
                                {{* Event attendance buttons *}}
                        {{if $item.isevent}}
                                <div class="btn-group" role="group">
-                                       <button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}},'attendyes');"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
-                                       <button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}},'attendno');"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
-                                       <button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}},'attendmaybe');"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
+                                       <button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}});"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
+                                       <button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}});"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
+                                       <button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}});"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
                                </div>
                        {{/if}}
 
index b196824c0296f29fd67b8b8c71271769b7b4d59f..e14caa542f252fa5733462f75099f036ebb7abc3 100644 (file)
@@ -39,8 +39,8 @@
                        {{/if}}
 
                        {{if $vote}}
-                               <a href="#" id="like-{{$id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$vote.like.0}}" onclick="dolike({{$id}},'like'); return false">{{$vote.like.1}}</a>
-                               <a href="#" id="dislike-{{$id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$vote.dislike.0}}" onclick="dolike({{$id}},'dislike'); return false">{{$vote.dislike.1}}</a>
+                               <a href="#" id="like-{{$id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$vote.like.0}}" onclick="dolike({{$id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$vote.like.1}}</a>
+                               <a href="#" id="dislike-{{$id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$vote.dislike.0}}" onclick="dolike({{$id}},'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$vote.dislike.1}}</a>
                        {{/if}}
 
                        {{if $vote.share}}
index 38ac6cf63de4d8a5702b7fa6fafbe95052d22215..0e4aaaf8f72a2156acb8131eaca2e9d34f8fc125 100644 (file)
                        {{/if}}
 
                        {{if $item.vote.like}}
-                               <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false">{{$item.vote.like.1}}</a>
+                               <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$item.vote.like.1}}</a>
                        {{/if}}
                        {{if $item.vote.dislike}}
-                               <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false">{{$item.vote.dislike.1}}</a>
+                               <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$item.vote.dislike.1}}</a>
                        {{/if}}
 
                        {{if $item.vote.share}}
index 10f8fe99879f82a925bee7ee2d0fa61499ea85b1..e6d8b97547d62685a73d5ea7d3f4c6f29d0ed95c 100644 (file)
                        {{/if}}
 
                        {{if $item.vote}}
-                               <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false">{{$item.vote.like.1}}</a>
+                               <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$item.vote.like.1}}</a>
                                {{if $item.vote.dislike}}
-                               <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false">{{$item.vote.dislike.1}}</a>
+                               <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$item.vote.dislike.1}}</a>
                                {{/if}}
                            {{if $item.vote.share}}
                                    <a href="#" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false">{{$item.vote.share.1}}</a>
                        {{if $item.isevent}}
                        <div class="clear"></div>
                        <div class="wall-item-actions-isevent">
-                               <a href="#" id="attendyes-{{$item.id}}"{{if $item.responses.attendyes.self}} class="active{{/if}}" title="{{$item.attend.0}}" onclick="dolike({{$item.id}},'attendyes'); return false;">{{$item.attend.0}}</a>
-                               <a href="#" id="attendno-{{$item.id}}"{{if $item.responses.attendno.self}} class="active{{/if}}" title="{{$item.attend.1}}" onclick="dolike({{$item.id}},'attendno'); return false;">{{$item.attend.1}}</a>
-                               <a href="#" id="attendmaybe-{{$item.id}}"{{if $item.responses.attendmaybe.self}} class="active{{/if}}" title="{{$item.attend.2}}" onclick="dolike({{$item.id}},'attendmaybe'); return false;">{{$item.attend.2}}</a>
+                               <a href="#" id="attendyes-{{$item.id}}"{{if $item.responses.attendyes.self}} class="active{{/if}}" title="{{$item.attend.0}}" onclick="dolike({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}}); return false;">{{$item.attend.0}}</a>
+                               <a href="#" id="attendno-{{$item.id}}"{{if $item.responses.attendno.self}} class="active{{/if}}" title="{{$item.attend.1}}" onclick="dolike({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}}); return false;">{{$item.attend.1}}</a>
+                               <a href="#" id="attendmaybe-{{$item.id}}"{{if $item.responses.attendmaybe.self}} class="active{{/if}}" title="{{$item.attend.2}}" onclick="dolike({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}}); return false;">{{$item.attend.2}}</a>
                        </div>
                        {{/if}}
 
index b372fbefbc0667113b7e65e65c4868011f94c707..85d480c31f551be1c2fed6150221dfdddfe73ee2 100644 (file)
@@ -91,9 +91,9 @@
 
                        {{if $item.vote}}
                        <div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$item.id}}">
-                               <a href="#" class="icon like{{if $item.responses.like.self}} self{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false"></a>
+                               <a href="#" class="icon like{{if $item.responses.like.self}} self{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false"></a>
                                {{if $item.vote.dislike}}
-                               <a href="#" class="icon dislike{{if $item.responses.dislike.self}} self{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false"></a>
+                               <a href="#" class="icon dislike{{if $item.responses.dislike.self}} self{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false"></a>
                                {{/if}}
                                {{if $item.vote.share}}
                                <a href="#" class="icon recycle wall-item-share-buttons" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false"></a>                             {{/if}}
index b65f7edd6ed503d1bc90ff40ac50abad1e6263f4..f0b7a608904e5b3f29685efaf40ffd977ceddfe0 100644 (file)
@@ -46,8 +46,8 @@
                        {{/if}}
 
                        {{if $vote}}
-                               <a href="#" id="like-{{$id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$vote.like.0}}" onclick="dolike({{$id}},'like'); return false">{{$vote.like.1}}</a>
-                               <a href="#" id="dislike-{{$id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$vote.dislike.0}}" onclick="dolike({{$id}},'dislike'); return false">{{$vote.dislike.1}}</a>
+                               <a href="#" id="like-{{$id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$vote.like.0}}" onclick="dolike({{$id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$vote.like.1}}</a>
+                               <a href="#" id="dislike-{{$id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$vote.dislike.0}}" onclick="dolike({{$id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$vote.dislike.1}}</a>
                        {{/if}}
 
                        {{if $vote.share}}
index c1bbaf7cf1936189379f3ab60c03de57a3a1b234..1813dd49f641314b0919b07ba94ab3ae3279916b 100644 (file)
                        {{/if}}
 
                        {{if $item.vote.like}}
-                               <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false">{{$item.vote.like.1}}</a>
+                               <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$item.vote.like.1}}</a>
                        {{/if}}
                        {{if $item.vote.dislike}}
-                               <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false">{{$item.vote.dislike.1}}</a>
+                               <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$item.vote.dislike.1}}</a>
                        {{/if}}
 
                        {{if $item.vote.share}}
index 31ab92a3d7a63a847cf5bd330762d7a14a596e1f..04ea7b424d09fda02075dc5e807e83a3f16602d9 100644 (file)
                        {{/if}}
 
                        {{if $item.isevent}}
-                               <a role="button" id="attendyes-{{$item.id}}"{{if $item.responses.attendyes.self}} class="active"{{/if}} title="{{$item.attend.0}}" onclick="dolike({{$item.id}},'attendyes'); return false;"><i class="icon-ok icon-large"><span class="sr-only">{{$item.attend.0}}</span></i></a>
-                               <a role="button" id="attendno-{{$item.id}}"{{if $item.responses.attendno.self}} class="active"{{/if}} title="{{$item.attend.1}}" onclick="dolike({{$item.id}},'attendno'); return false;"><i class="icon-remove icon-large"><span class="sr-only">{{$item.attend.1}}</span></i></a>
-                               <a role="button" id="attendmaybe-{{$item.id}}"{{if $item.responses.attendmaybe.self}} class="active"{{/if}} title="{{$item.attend.2}}" onclick="dolike({{$item.id}},'attendmaybe'); return false;"><i class="icon-question icon-large"><span class="sr-only">{{$item.attend.2}}</span></i></a>
+                               <a role="button" id="attendyes-{{$item.id}}"{{if $item.responses.attendyes.self}} class="active"{{/if}} title="{{$item.attend.0}}" onclick="dolike({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}}); return false;"><i class="icon-ok icon-large"><span class="sr-only">{{$item.attend.0}}</span></i></a>
+                               <a role="button" id="attendno-{{$item.id}}"{{if $item.responses.attendno.self}} class="active"{{/if}} title="{{$item.attend.1}}" onclick="dolike({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}}); return false;"><i class="icon-remove icon-large"><span class="sr-only">{{$item.attend.1}}</span></i></a>
+                               <a role="button" id="attendmaybe-{{$item.id}}"{{if $item.responses.attendmaybe.self}} class="active"{{/if}} title="{{$item.attend.2}}" onclick="dolike({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}}); return false;"><i class="icon-question icon-large"><span class="sr-only">{{$item.attend.2}}</span></i></a>
                        {{/if}}
 
                        {{if $item.vote}}
                                {{if $item.vote.like}}
-                               <a role="button" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false"><i class="icon-thumbs-up icon-large"><span class="sr-only">{{$item.vote.like.0}}</span></i></a>
+                               <a role="button" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false"><i class="icon-thumbs-up icon-large"><span class="sr-only">{{$item.vote.like.0}}</span></i></a>
                                {{/if}}{{if $item.vote.dislike}}
-                               <a role="button" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false"><i class="icon-thumbs-down icon-large"><span class="sr-only">{{$item.vote.dislike.0}}</span></i></a>
+                               <a role="button" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false"><i class="icon-thumbs-down icon-large"><span class="sr-only">{{$item.vote.dislike.0}}</span></i></a>
                                {{/if}}
                            {{if $item.vote.share}}
                                    <a role="button" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false"><i class="icon-retweet icon-large"><span class="sr-only">{{$item.vote.share.0}}</span></i></a>