diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 1082bf642..960cc82a9 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -129,7 +129,7 @@ class ThreadItem { if($item['author']['xchan_network'] === 'rss') $shareable = true; - $repeatable = ((($conv->get_profile_owner() == local_channel() && local_channel()) && (intval($item['item_private']) === 0) && (in_array($item['author']['xchan_network'], ['zot6', 'activitypub']))) ? true : false); + $repeatable = (intval($item['item_private']) === 0 && in_array($item['author']['xchan_network'], ['zot6', 'activitypub'])); // @fixme // Have recently added code to properly handle polls in group reshares by redirecting all of the poll responses to the group. @@ -204,9 +204,11 @@ class ThreadItem { $response_verbs[] = 'dislike'; } - $response_verbs[] = 'announce'; + if ($repeatable) { + $response_verbs[] = 'announce'; + } - if(in_array($item['obj_type'], ['Event', ACTIVITY_OBJ_EVENT])) { + if (in_array($item['obj_type'], ['Event', ACTIVITY_OBJ_EVENT])) { $response_verbs[] = 'attendyes'; $response_verbs[] = 'attendno'; $response_verbs[] = 'attendmaybe'; @@ -216,18 +218,18 @@ class ThreadItem { } } - if($item['obj_type'] === 'Question') { + if ($item['obj_type'] === 'Question') { $response_verbs[] = 'answer'; } - if(! feature_enabled($conv->get_profile_owner(),'dislike')) + if (!feature_enabled($conv->get_profile_owner(),'dislike')) { unset($conv_responses['dislike']); + } $responses = get_responses($conv_responses,$response_verbs,$this,$item); $my_responses = []; foreach($response_verbs as $v) { - $my_responses[$v] = ((isset($conv_responses[$v][$item['mid'] . '-m'])) ? 1 : 0); } @@ -327,11 +329,13 @@ class ThreadItem { $like = []; $dislike = []; $reply_to = []; + $reactions_allowed = false; if($this->is_commentable() && $observer) { $like = array( t("I like this \x28toggle\x29"), t("like")); $dislike = array( t("I don't like this \x28toggle\x29"), t("dislike")); - $reply_to = array( t("Reply on this comment"), t("reply"), t("Reply to")); + $reply_to = array( t("Reply to this comment"), t("reply"), t("Reply to")); + $reactions_allowed = true; } $share = []; @@ -539,6 +543,7 @@ class ThreadItem { 'moderate_approve' => t('Approve'), 'moderate_delete' => t('Delete'), 'rtl' => in_array($item['lang'], rtl_languages()), + 'reactions_allowed' => $reactions_allowed ); $arr = array('item' => $item, 'output' => $tmp_item); diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 3d13655d2..233e0b05a 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1429,7 +1429,6 @@ class Item extends Controller { require_once('include/items.php'); - $i = q("select id, uid, item_origin, author_xchan, owner_xchan, source_xchan, item_type from item where id = %d limit 1", intval(argv(2)) ); diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 4460900a8..d493742e7 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -569,6 +569,11 @@ class Like extends Controller { call_hooks('post_local_end', $arr); + if ($is_rsvp && in_array($verb, ['attendyes', 'attendmaybe'])) { + event_addtocal($item_id, local_channel()); + } + + $r = q("select * from item where id = %d", intval($post_id) ); diff --git a/Zotlabs/Module/Settings/Conversation.php b/Zotlabs/Module/Settings/Conversation.php index aa0ff6a7e..5f3d903a8 100644 --- a/Zotlabs/Module/Settings/Conversation.php +++ b/Zotlabs/Module/Settings/Conversation.php @@ -11,24 +11,19 @@ class Conversation { $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); - - Libsync::build_sync_packet(); - - if($_POST['aj']) { - if($_POST['auto_update'] == 1) - info(t('Settings saved.') . EOL); - else - info(t('Settings saved. Reload page please.') . EOL); + Libsync::build_sync_packet(); + + if($_POST['aj']) { killme(); } - else { - return; - } + + return; + } function get() { @@ -48,7 +43,7 @@ class Conversation { '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - + if($aj) { echo $o; killme(); diff --git a/include/conversation.php b/include/conversation.php index c631d53a2..a4f54fd85 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1525,6 +1525,12 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) { $ret = array(); foreach($response_verbs as $v) { + if ($v === 'answer') { + // we require the structure to collect the response hashes + // but we do not use them for display - do not collect them. + continue; + } + $ret[$v] = []; $ret[$v]['count'] = $conv_responses[$v][$item['mid']] ?? 0; $ret[$v]['list'] = ((isset($conv_responses[$v][$item['mid']])) ? $conv_responses[$v][$item['mid'] . '-l'] : ''); @@ -1533,14 +1539,6 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) { $ret[$v]['modal'] = (($ret[$v]['count'] > MAX_LIKERS) ? true : false); } - $count = 0; - foreach ($ret as $key) { - if ($key['count'] == true) - $count++; - } - - $ret['count'] = $count; - //logger('ret: ' . print_r($ret,true)); return $ret; @@ -1549,25 +1547,25 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) { function get_response_button_text($v,$count) { switch($v) { case 'like': - return ['label' => tt('Like','Likes',$count,'noun'), 'icon' => 'thumbs-o-up', 'class' => 'like']; + return ['label' => tt('Like','Likes',$count,'noun'), 'icon' => 'thumbs-o-up', 'class' => 'like', 'onclick' => 'dolike']; break; case 'announce': - return ['label' => tt('Repeat','Repeats',$count,'noun'), 'icon' => 'retweet', 'class' => 'announce']; + return ['label' => tt('Repeat','Repeats',$count,'noun'), 'icon' => 'retweet', 'class' => 'announce', 'onclick' => 'jotShare']; break; case 'dislike': - return ['label' => tt('Dislike','Dislikes',$count,'noun'), 'icon' => 'thumbs-o-down', 'class' => 'dislike']; + return ['label' => tt('Dislike','Dislikes',$count,'noun'), 'icon' => 'thumbs-o-down', 'class' => 'dislike', 'onclick' => 'dolike']; break; case 'attendyes': - return ['label' => tt('Attending','Attending',$count,'noun'), 'icon' => 'calendar-check-o', 'class' => 'attendyes']; + return ['label' => tt('Attending','Attending',$count,'noun'), 'icon' => 'calendar-check-o', 'class' => 'attendyes', 'onclick' => 'dolike']; break; case 'attendno': - return ['label' => tt('Not Attending','Not Attending',$count,'noun'), 'icon' => 'calendar-times-o', 'class' => 'attendno']; + return ['label' => tt('Not Attending','Not Attending',$count,'noun'), 'icon' => 'calendar-times-o', 'class' => 'attendno', 'onclick' => 'dolike']; break; case 'attendmaybe': - return ['label' => tt('Undecided','Undecided',$count,'noun'), 'icon' => 'calendar-o', 'class' => 'attendmaybe']; + return ['label' => tt('Undecided','Undecided',$count,'noun'), 'icon' => 'calendar-o', 'class' => 'attendmaybe', 'onclick' => 'dolike']; break; default: - return ''; + return []; break; } } diff --git a/util/update_db b/util/update_db old mode 100644 new mode 100755 diff --git a/view/js/main.js b/view/js/main.js index 2ad7b86fb..782ce4b62 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -256,19 +256,18 @@ function getConversationSettings() { } function postConversationSettings() { - $.post( - 'settings/conversation', - $('#settings_module_ajax_form').serialize() + "&auto_update=" + next_page - ); - if(next_page === 1) { page_load = true; } - $('#conversation_settings').modal('hide'); - - if(timer) clearTimeout(timer); - timer = setTimeout(updateInit,100); + $.post( + 'settings/conversation', + $('#settings_module_ajax_form').serialize() + "&auto_update=" + next_page + ).done(function() { + $('#conversation_settings').modal('hide'); + toast('Conversation features updated', 'info'); + updateInit(); + }); return false; } @@ -1305,7 +1304,7 @@ function dropItem(url, object, b64mid) { $(object + ', #pinned-wrapper-' + id).remove(); $('body').css('cursor', 'auto'); - toast(aStr.itemdel, 'info') + toast(aStr.itemdel, 'info'); //$.jGrowl(aStr.itemdel, { sticky: false, theme: 'info', life: 3000 }); if (typeof b64mid !== typeof undefined) { @@ -1361,8 +1360,8 @@ function dostar(ident) { $('#starred-' + ident).removeClass('fa-star-o'); $('#star-' + ident).addClass('hidden'); $('#unstar-' + ident).removeClass('hidden'); - var btn_tpl = '
' - $('#wall-item-tools-left-' + ident).prepend(btn_tpl); + var btn_tpl = '
' + $('#wall-item-tools-right-' + ident).prepend(btn_tpl); } else { $('#starred-' + ident).addClass('unstarred'); diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index 61886c3ee..db83ae5c7 100644 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -101,159 +101,12 @@ {{/if}} -
-
-
-
-
-
-
- {{if $item.toplevel && $item.emojis && $item.reactions}} -
- - -
- {{/if}} - {{if $item.moderate}} - {{$item.moderate_approve}} - {{$item.moderate_delete}} - {{else}} -
- {{if $item.like}} - - {{/if}} - {{if $item.dislike}} - - {{/if}} - {{if $item.reply_to}} - - {{/if}} - {{if $item.isevent}} - - {{/if}} - {{if $item.canvote}} - - {{/if}} -
- - -
-
- {{/if}} -
- - {{if $item.responses || $item.attachments}} +
- {{if $item.star && $item.star.isstarred}} -
- -
- {{/if}} - {{if $item.attachments}} -
- - -
- {{/if}} {{foreach $item.responses as $verb=>$response}} - {{if $response.count}} + {{if $item.reactions_allowed || (!$item.reactions_allowed && $response.count)}}
- + {{if $response.modal}} {{else}} - + {{/if}}
{{/if}} {{/foreach}} + {{if $item.toplevel && $item.emojis && $item.reactions}} +
+ + +
+ {{/if}} +
+
+
+
+
+
+
+ {{if $item.moderate}} + {{$item.moderate_approve}} + {{$item.moderate_delete}} + {{else}} + {{if $item.star && $item.star.isstarred}} +
+ +
+ {{/if}} + {{if $item.attachments}} +
+ + +
+ {{/if}} + {{if $item.reply_to}} + + {{/if}} +
+ + +
+ {{/if}}
- {{/if}}
diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl index 374c3f53f..d164122e9 100644 --- a/view/tpl/conv_list.tpl +++ b/view/tpl/conv_list.tpl @@ -102,159 +102,43 @@ {{/if}} -
-
- {{if $item.toplevel && $item.emojis && $item.reactions}} -
- - -
- {{/if}} -
- {{if $item.like}} - - {{/if}} - {{if $item.dislike}} - - {{/if}} - {{if $item.isevent}} - - {{/if}} - {{if $item.canvote}} - - {{/if}} -
- - -
-
-
-
-
- {{if $item.star && $item.star.isstarred}} -
- -
- {{/if}} - {{if $item.attachments}} -
- - -
- {{/if}} +
+
- {{if $item.unseen_comments}} + {{**if $item.unseen_comments}}
-
- {{/if}} - {{if $item.responses }} + {{/if**}} {{foreach $item.responses as $verb=>$response}} - {{if $response.count}} + {{if $item.reactions_allowed || (!$item.reactions_allowed && $response.count)}}
- + {{if $response.modal}} +
+ {{if $item.moderate}} + {{$item.moderate_approve}} + {{$item.moderate_delete}} + {{else}} + {{if $item.star && $item.star.isstarred}} +
+ +
+ {{/if}} + {{if $item.attachments}} +
+ + +
+ {{/if}} + {{if $item.reply_to}} + + {{/if}} +
+ + +
{{/if}}
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 67ba1824b..ac71ef5dd 100644 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -374,6 +374,7 @@ var activeCommentText = ''; timer = setTimeout(updateInit,1000); } +/* function toggleVoting() { if($('#jot-consensus').val() > 0) { $('#jot-consensus').val(0); @@ -384,6 +385,7 @@ var activeCommentText = ''; $('#profile-voting, #profile-voting-sub').removeClass('fa-square-o').addClass('fa-check-square-o'); } } +*/ function toggleNoComment() { if($('#jot-nocomment').val() > 0) { @@ -400,6 +402,7 @@ var activeCommentText = ''; function jotReact(id,icon) { if(id && icon) { + $('#like-rotator-' + id).show(); $.get('{{$baseurl}}/react?f=&postid=' + id + '&emoji=' + icon); if(timer) clearTimeout(timer); timer = setTimeout(updateInit,1000); diff --git a/view/tpl/search_item.tpl b/view/tpl/search_item.tpl index 2c4aab9f4..a00c0a32e 100644 --- a/view/tpl/search_item.tpl +++ b/view/tpl/search_item.tpl @@ -101,49 +101,86 @@
{{/if}}
-
-
-
-
-
-
- {{if $item.mode === 'moderate'}} - {{$item.approve}} - {{$item.delete}} +
+ {{if $item.moderate}} + {{$item.moderate_approve}} + {{$item.moderate_delete}} {{else}} - {{if $item.star || $item.thread_action_menu || $item.drop.dropping}} -
- +
+ {{/if}} + {{if $item.attachments}} +
+ + +
+ {{/if}} + {{if $item.reply_to}} + + {{/if}} +
+ - {{/if}} - {{/if}}
- {{if $item.star && $item.star.isstarred}} -
- -
- {{/if}} - {{if $item.attachments}} -
- - -
- {{/if}}
{{if $item.conv}}