diff --git a/QvitterPlugin.php b/QvitterPlugin.php index 0d22617..e91162d 100644 --- a/QvitterPlugin.php +++ b/QvitterPlugin.php @@ -591,13 +591,15 @@ class QvitterPlugin extends Plugin { } $twitter_status['repeat_num'] = $repeatnum; + $twitter_status['is_post_verb'] = ActivityUtils::compareVerbs($notice->verb, array(ActivityVerb::POST)); + // some more metadata about notice if($notice->is_local == '1') { $twitter_status['is_local'] = true; } else { $twitter_status['is_local'] = false; - if($notice->object_type != 'activity') { + if ($twitter_status['is_post_verb'] === true) { try { $twitter_status['external_url'] = $notice->getUrl(true); } catch (InvalidUrlException $e) { @@ -606,12 +608,6 @@ class QvitterPlugin extends Plugin { } } - if($notice->source == 'activity' || $notice->object_type == 'activity' || $notice->object_type == 'http://activitystrea.ms/schema/1.0/activity' || $notice->verb == 'delete') { - $twitter_status['is_activity'] = true; - } - else { - $twitter_status['is_activity'] = false; - } if(ActivityUtils::compareTypes($notice->verb, array('qvitter-delete-notice', 'delete'))) { $twitter_status['qvitter_delete_notice'] = true; @@ -776,8 +772,8 @@ class QvitterPlugin extends Plugin { } } - // don't add notifications for activity type notices - if($notice->source == 'activity' || $notice->object_type == 'activity' || $notice->object_type == 'http://activitystrea.ms/schema/1.0/activity') { + // don't add notifications for activity/non-post-verb notices + if($notice->source == 'activity' || !ActivityUtils::compareVerbs($notice->verb, array(ActivityVerb::POST))) { return true; } diff --git a/js/dom-functions.js b/js/dom-functions.js index 56c6ebd..7eb911d 100644 --- a/js/dom-functions.js +++ b/js/dom-functions.js @@ -1550,7 +1550,7 @@ function addToFeed(feed, after, extraClasses) { if(window.currentStreamObject.name == 'notifications') { // don't show any notices with object_type "activity" - if(typeof obj.notice != 'undefined' && obj.notice !== null && obj.notice.is_activity === true) { + if(typeof obj.notice != 'undefined' && obj.notice !== null && obj.notice.is_post_verb === false) { return true; } @@ -1861,7 +1861,7 @@ function buildQueetHtml(obj, idInStream, extraClasses, requeeted_by, isConversat } // activity? (hidden with css) - if(obj.source == 'activity' || obj.is_activity === true) { + if(obj.source == 'activity' || obj.is_post_verb === false) { extraClasses += ' activity always-hidden'; // because we had an xss issue with activities, the obj.statusnet_html of qvitter-deleted-activity-notices can contain unwanted html, so we escape, they are hidden anyway diff --git a/js/misc-functions.js b/js/misc-functions.js index 7e81617..9f4c932 100644 --- a/js/misc-functions.js +++ b/js/misc-functions.js @@ -832,7 +832,7 @@ function searchForUpdatedNoticeData(obj) { // sometimes activity notices don't get the is_activity flag set to true // maybe because they were in the process of being saved when // we first got them - if(obj.is_activity) { + if(obj.is_post_verb === false) { streamItemFoundInFeed.addClass('activity always-hidden'); }