aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-06-27 14:53:23 +0000
committerMario <mario@mariovavti.com>2023-06-27 14:53:23 +0000
commit750641ef196d9e113b0e80da9734f70400b55652 (patch)
treeebfa9136bde34242294a4ae896e4b3ab7089286d
parentfb48dfc08246d8f1eca2fa13b7c976bd29058693 (diff)
downloadvolse-hubzilla-750641ef196d9e113b0e80da9734f70400b55652.tar.gz
volse-hubzilla-750641ef196d9e113b0e80da9734f70400b55652.tar.bz2
volse-hubzilla-750641ef196d9e113b0e80da9734f70400b55652.zip
implement inline moderation of reactions
-rw-r--r--Zotlabs/Lib/Enotify.php10
-rw-r--r--Zotlabs/Module/Hq.php6
-rw-r--r--Zotlabs/Module/Moderate.php4
-rw-r--r--include/conversation.php7
-rw-r--r--view/tpl/conv_item.tpl4
5 files changed, 15 insertions, 16 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 1eb05da08..c3f96e103 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -145,7 +145,7 @@ class Enotify {
$itemlink = $params['link'];
- $action = (($moderated) ? t('requests to comment on') : t('commented on'));
+ $action = (($moderated) ? t('requested to comment on') : t('commented on'));
if(array_key_exists('item',$params)) {
@@ -158,10 +158,10 @@ class Enotify {
}
if(activity_match($params['verb'], ACTIVITY_LIKE))
- $action = (($moderated) ? t('requests to like') : t('liked'));
+ $action = (($moderated) ? t('requested to like') : t('liked'));
if(activity_match($params['verb'], ACTIVITY_DISLIKE))
- $action = (($moderated) ? t('requests to dislike') : t('disliked'));
+ $action = (($moderated) ? t('requested to dislike') : t('disliked'));
}
@@ -311,10 +311,10 @@ class Enotify {
$moderated = (($params['item']['item_blocked'] == ITEM_MODERATED) ? true : false);
if(activity_match($params['item']['verb'], ACTIVITY_LIKE))
- $verb = (($moderated) ? t('requests to like') : t('liked'));
+ $verb = (($moderated) ? t('requested to like') : t('liked'));
if(activity_match($params['item']['verb'], ACTIVITY_DISLIKE))
- $verb = (($moderated) ? t('requests to dislike') : t('disliked'));
+ $verb = (($moderated) ? t('requested to dislike') : t('disliked'));
// "your post"
if($p[0]['owner']['xchan_name'] === $p[0]['author']['xchan_name'] && intval($p[0]['item_wall']))
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 260d0c41b..05b48f119 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -67,12 +67,6 @@ class Hq extends \Zotlabs\Web\Controller {
}
}
- // if the item is to be moderated redirect to /moderate
- // comments can be moderated inline
- if(intval($target_item['item_blocked']) === ITEM_MODERATED && in_array($target_item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDMAYBE, ACTIVITY_ATTENDNO])) {
- goaway(z_root() . '/moderate/' . $target_item['id']);
- }
-
$simple_update = '';
if($update && $_SESSION['loadtime'])
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
diff --git a/Zotlabs/Module/Moderate.php b/Zotlabs/Module/Moderate.php
index b895b4a8c..ed2a1e4f9 100644
--- a/Zotlabs/Module/Moderate.php
+++ b/Zotlabs/Module/Moderate.php
@@ -67,7 +67,7 @@ class Moderate extends \Zotlabs\Web\Controller {
$item['item_blocked'] = 0;
item_update_parent_commented($item);
- notice( t('Comment approved') . EOL);
+ notice( t('Item approved') . EOL);
}
elseif($action === 'drop') {
// TODO: not implemented
@@ -75,7 +75,7 @@ class Moderate extends \Zotlabs\Web\Controller {
// Activity::send_rejection_activity(App::get_channel(), $item['author_xchan'], $item);
drop_item($post_id,false);
- notice( t('Comment deleted') . EOL);
+ notice( t('Item deleted') . EOL);
}
// refetch the item after changes have been made
diff --git a/include/conversation.php b/include/conversation.php
index 2f0b6f6fd..c02b0c4c8 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1215,11 +1215,16 @@ function builtin_activity_puller($item, &$conv_responses) {
if((activity_match($item['verb'], $verb)) && ($item['id'] != $item['parent'])) {
$name = (($item['author']['xchan_name']) ? $item['author']['xchan_name'] : t('Unknown'));
+
+ $moderate = ((intval($item['item_blocked']) === ITEM_MODERATED) ? '<a href="moderate/' . $item['id'] . '/approve" onclick="moderate_approve(' . $item['id'] . '); return false;" class="text-success pe-2" title="' . t('Approve this item') . '"><i class="fa fa-check" ></i></a><a href="moderate/' . $item['id'] . '/drop" onclick="moderate_drop(' . $item['id'] . '); return false;" class="text-danger pe-2" title="' . t('Delete this item') . '"><i class="fa fa-trash-o" ></i></a>' : '');
+
$url = (($item['author_xchan'] && $item['author']['xchan_photo_s'])
- ? '<a class="dropdown-item" href="' . chanlink_hash($item['author_xchan']) . '">' . '<img class="menu-img-1" src="' . zid($item['author']['xchan_photo_s']) . '" alt="' . urlencode($name) . '" /> ' . $name . '</a>'
+ ? '<div class="dropdown-item">' . $moderate . '<a href="' . chanlink_hash($item['author_xchan']) . '" class="text-reset">' . '<img class="menu-img-1" src="' . zid($item['author']['xchan_photo_s']) . '" alt="' . urlencode($name) . '" /> ' . $name . '</a></div>'
: '<a class="dropdown-item" href="#" class="disabled">' . $name . '</a>'
);
+
+
if(! $item['thr_parent'])
$item['thr_parent'] = $item['parent_mid'];
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index cd2130295..5f6c4f6c6 100644
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -121,8 +121,8 @@
</div>
{{/if}}
{{if $item.moderate}}
- <a href="#" onclick="moderate_approve({{$item.id}}); return false;" class="btn btn-sm btn-outline-success"><i class="fa fa-check" ></i> {{$item.moderate_approve}}</a>
- <a href="#" onclick="moderate_drop({{$item.id}}); return false;" class="btn btn-sm btn-outline-danger"><i class="fa fa-trash-o" ></i> {{$item.moderate_delete}}</a>
+ <a href="moderate/{{$item.id}}/approve" onclick="moderate_approve({{$item.id}}); return false;" class="btn btn-sm btn-outline-success"><i class="fa fa-check" ></i> {{$item.moderate_approve}}</a>
+ <a href="moderate/{{$item.id}}/drop" onclick="moderate_drop({{$item.id}}); return false;" class="btn btn-sm btn-outline-danger"><i class="fa fa-trash-o" ></i> {{$item.moderate_delete}}</a>
{{else}}
<div class="btn-group">
{{if $item.like}}