Merge pull request #335 from mmn/is_activity_to_is_post

Change 'is_activity' to the inverse, 'is_post_verb'
This commit is contained in:
Hannes Mannerheim 2016-01-05 13:16:32 +01:00
commit 37d94defdd
3 changed files with 8 additions and 12 deletions

View File

@ -591,13 +591,15 @@ class QvitterPlugin extends Plugin {
} }
$twitter_status['repeat_num'] = $repeatnum; $twitter_status['repeat_num'] = $repeatnum;
$twitter_status['is_post_verb'] = ActivityUtils::compareVerbs($notice->verb, array(ActivityVerb::POST));
// some more metadata about notice // some more metadata about notice
if($notice->is_local == '1') { if($notice->is_local == '1') {
$twitter_status['is_local'] = true; $twitter_status['is_local'] = true;
} }
else { else {
$twitter_status['is_local'] = false; $twitter_status['is_local'] = false;
if($notice->object_type != 'activity') { if ($twitter_status['is_post_verb'] === true) {
try { try {
$twitter_status['external_url'] = $notice->getUrl(true); $twitter_status['external_url'] = $notice->getUrl(true);
} catch (InvalidUrlException $e) { } 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'))) { if(ActivityUtils::compareTypes($notice->verb, array('qvitter-delete-notice', 'delete'))) {
$twitter_status['qvitter_delete_notice'] = true; $twitter_status['qvitter_delete_notice'] = true;
@ -776,8 +772,8 @@ class QvitterPlugin extends Plugin {
} }
} }
// don't add notifications for activity type notices // don't add notifications for activity/non-post-verb notices
if($notice->source == 'activity' || $notice->object_type == 'activity' || $notice->object_type == 'http://activitystrea.ms/schema/1.0/activity') { if($notice->source == 'activity' || !ActivityUtils::compareVerbs($notice->verb, array(ActivityVerb::POST))) {
return true; return true;
} }

View File

@ -1550,7 +1550,7 @@ function addToFeed(feed, after, extraClasses) {
if(window.currentStreamObject.name == 'notifications') { if(window.currentStreamObject.name == 'notifications') {
// don't show any notices with object_type "activity" // 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; return true;
} }
@ -1861,7 +1861,7 @@ function buildQueetHtml(obj, idInStream, extraClasses, requeeted_by, isConversat
} }
// activity? (hidden with css) // 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'; 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 // 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

View File

@ -832,7 +832,7 @@ function searchForUpdatedNoticeData(obj) {
// sometimes activity notices don't get the is_activity flag set to true // sometimes activity notices don't get the is_activity flag set to true
// maybe because they were in the process of being saved when // maybe because they were in the process of being saved when
// we first got them // we first got them
if(obj.is_activity) { if(obj.is_post_verb === false) {
streamItemFoundInFeed.addClass('activity always-hidden'); streamItemFoundInFeed.addClass('activity always-hidden');
} }