aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r--Zotlabs/Widget/Messages.php31
-rw-r--r--Zotlabs/Widget/Pinned.php40
2 files changed, 26 insertions, 45 deletions
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 2a612c2ce..8654d8e8f 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -61,8 +61,8 @@ class Messages {
$channel = App::get_channel();
$item_normal = item_normal();
- $item_normal .= " and item.verb not in ('Add', 'Remove', '" . ACTIVITY_FOLLOW . "', '" . ACTIVITY_TAG . "') ";
-
+ // Filter internal follow activities and strerams add/remove activities
+ $item_normal .= " and item.verb not in ('Add', 'Remove', 'Follow', 'Ignore', '" . ACTIVITY_FOLLOW . "') ";
$item_normal_i = str_replace('item.', 'i.', $item_normal);
$item_normal_c = str_replace('item.', 'c.', $item_normal);
$entries = [];
@@ -76,16 +76,16 @@ class Messages {
$vnotify_sql_i = '';
if (!($vnotify & VNOTIFY_LIKE)) {
- $vnotify_sql_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
- $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_c = " AND c.verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_i = " AND i.verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
elseif (!feature_enabled(local_channel(), 'dislike')) {
- $vnotify_sql_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
- $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_c = " AND c.verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_i = " AND i.verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
if($author) {
- $author_sql = " AND i.owner_xchan = '" . protect_sprintf(dbesc($author)) . "' ";
+ $author_sql = " AND (i.owner_xchan = '" . protect_sprintf(dbesc($author)) . "') ";
}
switch($type) {
@@ -102,11 +102,8 @@ class Messages {
$type_sql = ' AND i.item_private IN (0, 1) ';
}
- // FEP-5624 filter approvals for comments
- $approvals_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject') ";
-
$items = q("SELECT *,
- (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $item_normal_c $approvals_c $vnotify_sql_c) AS unseen_count
+ (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $item_normal_c $vnotify_sql_c) AS unseen_count
FROM item i WHERE i.uid = %d
AND i.created <= '%s'
$type_sql
@@ -148,6 +145,9 @@ class Messages {
if($item['owner_xchan'] !== $item['author_xchan']) {
$info .= t('via') . ' ' . $item['owner']['xchan_name'];
}
+ elseif($item['verb'] === 'Announce' && isset($item['source'])) {
+ $info .= t('via') . ' ' . $item['source']['xchan_name'];
+ }
$summary = $item['title'];
if (!$summary) {
@@ -185,8 +185,9 @@ class Messages {
$entries[$i]['info'] = $info;
$entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $item['created']);
$entries[$i]['summary'] = $summary;
- $entries[$i]['b64mid'] = gen_link_id($item['mid']);
- $entries[$i]['href'] = z_root() . '/hq/' . gen_link_id($item['mid']);
+ //$entries[$i]['b64mid'] = gen_link_id($item['mid']);
+ $entries[$i]['b64mid'] = $item['uuid'];
+ $entries[$i]['href'] = z_root() . '/hq/' . $item['uuid'];
$entries[$i]['icon'] = $icon;
$entries[$i]['unseen_count'] = (($item['unseen_count']) ? $item['unseen_count'] : (($item['item_unseen']) ? '&#8192;' : ''));
$entries[$i]['unseen_class'] = (($item['item_unseen']) ? 'primary' : 'secondary');
@@ -290,8 +291,8 @@ class Messages {
$entries[$i]['info'] = '';
$entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $notice['created']);
$entries[$i]['summary'] = $summary;
- $entries[$i]['b64mid'] = (($notice['ntype'] & NOTIFY_INTRO) ? '' : basename($notice['link']));
- $entries[$i]['href'] = (($notice['ntype'] & NOTIFY_INTRO) ? $notice['link'] : z_root() . '/hq/' . basename($notice['link']));
+ $entries[$i]['b64mid'] = (($notice['ntype'] & NOTIFY_INTRO) ? '' : ((str_contains($notice['hash'], '-')) ? $notice['hash'] : basename($notice['link'])));
+ $entries[$i]['href'] = (($notice['ntype'] & NOTIFY_INTRO) ? $notice['link'] : z_root() . '/hq/' . ((str_contains($notice['hash'], '-')) ? $notice['hash'] : basename($notice['link'])));
$entries[$i]['icon'] = (($notice['ntype'] & NOTIFY_INTRO) ? '<i class="fa fa-user-plus"></i>' : '');
$i++;
diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php
index bd1c0e462..1380c156b 100644
--- a/Zotlabs/Widget/Pinned.php
+++ b/Zotlabs/Widget/Pinned.php
@@ -46,7 +46,7 @@ class Pinned {
foreach($items as $item) {
- $midb64 = gen_link_id($item['mid']);
+ $midb64 = $item['uuid'];
if(isset($observer['xchan_hash']) && in_array($observer['xchan_hash'], get_pconfig($item['uid'], 'pinned_hide', $midb64, [])))
continue;
@@ -77,17 +77,6 @@ class Pinned {
}
}
- $consensus = (intval($item['item_consensus']) ? true : false);
- if($consensus) {
- $conv_responses['agree'] = [ 'title' => t('Agree','title') ];
- $conv_responses['disagree'] = [ 'title' => t('Disagree','title') ];
- $conv_responses['abstain'] = [ 'title' => t('Abstain','title') ];
- if($commentable && $observer) {
- $conlabels = [ t('I agree'), t('I disagree'), t('I abstain') ];
- $canvote = true;
- }
- }
-
$this->activity($item, $conv_responses);
$verified = (intval($item['item_verified']) ? t('Message signature validated') : '');
@@ -203,7 +192,7 @@ class Pinned {
if(empty($mids_list))
return [];
- $r = q("SELECT * FROM item WHERE mid IN ( '%s' ) AND uid = %d AND id = parent AND item_private = 0 ORDER BY created DESC",
+ $r = q("SELECT * FROM item WHERE uuid IN ( '%s' ) AND uid = %d AND id = parent AND item_private = 0 ORDER BY created DESC",
dbesc(implode(",", $mids_list)),
intval($this->uid)
);
@@ -225,39 +214,30 @@ class Pinned {
private function activity($item, &$conv_responses) {
foreach(array_keys($conv_responses) as $verb) {
+ $verb_sql = '';
switch($verb) {
case 'like':
- $v = ACTIVITY_LIKE;
+ $verb_sql = " AND verb IN ('Like', '" . ACTIVITY_LIKE . "') ";
break;
case 'dislike':
- $v = ACTIVITY_DISLIKE;
- break;
- case 'agree':
- $v = ACTIVITY_AGREE;
- break;
- case 'disagree':
- $v = ACTIVITY_DISAGREE;
- break;
- case 'abstain':
- $v = ACTIVITY_ABSTAIN;
+ $verb_sql = " AND verb IN ('Dislike', '" . ACTIVITY_DISLIKE . "') ";
break;
case 'attendyes':
- $v = ACTIVITY_ATTEND;
+ $verb_sql = " AND verb IN ('Accept', '" . ACTIVITY_ATTEND . "') ";
break;
case 'attendno':
- $v = ACTIVITY_ATTENDNO;
+ $verb_sql = " AND verb IN ('Reject', '" . ACTIVITY_ATTENDNO . "') ";
break;
case 'attendmaybe':
- $v = ACTIVITY_ATTENDMAYBE;
+ $verb_sql = " AND verb IN ('TentativeAccept', '" . ACTIVITY_ATTENDMAYBE . "') ";
break;
default:
break;
}
- $r = q("SELECT * FROM item WHERE parent = %d AND id <> parent AND verb = '%s' AND item_deleted = 0",
- intval($item['id']),
- dbesc($v)
+ $r = q("SELECT * FROM item WHERE parent = %d AND id <> parent $verb_sql AND item_deleted = 0",
+ intval($item['id'])
);
if(! $r) {
unset($conv_responses[$verb]);