diff options
author | David Yip <yipdw@member.fsf.org> | 2017-10-16 01:29:02 -0500 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2017-10-16 01:29:02 -0500 |
commit | 6cd5b3bbe5a11fcf25bbefba2803f2ae840f39fc (patch) | |
tree | 4bb60f4493fb70cada728a373f74c18b87e8f95d /app/lib | |
parent | f72ad67a3967230afd63a9e2d84a2a69331c4787 (diff) | |
parent | 894da3dcca781e27ce9c5130f1021526ac8a6887 (diff) |
Merge remote-tracking branch 'origin/master' into gs-master
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/activitypub/activity/undo.rb | 3 | ||||
-rw-r--r-- | app/lib/feed_manager.rb | 5 | ||||
-rw-r--r-- | app/lib/ostatus/atom_serializer.rb | 16 |
3 files changed, 13 insertions, 11 deletions
diff --git a/app/lib/activitypub/activity/undo.rb b/app/lib/activitypub/activity/undo.rb index 4b0905de2..cbed417c4 100644 --- a/app/lib/activitypub/activity/undo.rb +++ b/app/lib/activitypub/activity/undo.rb @@ -17,7 +17,8 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity private def undo_announce - status = Status.find_by(uri: object_uri, account: @account) + status = Status.find_by(uri: object_uri, account: @account) + status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present? if status.nil? delete_later!(object_uri) diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index f6a694135..5a3af7206 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -85,7 +85,7 @@ class FeedManager oldest_home_score = redis.zrange(timeline_key, 0, 0, with_scores: true)&.first&.last&.to_i || 0 from_account.statuses.select('id, reblog_of_id').where('id > ?', oldest_home_score).reorder(nil).find_each do |status| - unpush(:home, into_account, status) + remove_from_feed(:home, into_account, status) end end @@ -121,7 +121,8 @@ class FeedManager #return true if reggie === status.content || reggie === status.spoiler_text # extremely violent filtering code END - return true if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?) + return false if receiver_id == status.account_id + return true if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?) check_for_mutes = [status.account_id] check_for_mutes.concat([status.reblog.account_id]) if status.reblog? diff --git a/app/lib/ostatus/atom_serializer.rb b/app/lib/ostatus/atom_serializer.rb index a1ac11a51..3ca6c5943 100644 --- a/app/lib/ostatus/atom_serializer.rb +++ b/app/lib/ostatus/atom_serializer.rb @@ -23,7 +23,7 @@ class OStatus::AtomSerializer append_element(author, 'name', account.username) append_element(author, 'email', account.local? ? account.local_username_and_domain : account.acct) append_element(author, 'summary', Formatter.instance.simplified_format(account).to_str, type: :html) if account.note? - append_element(author, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(account)) + append_element(author, 'link', nil, rel: :alternate, type: 'text/html', href: ::TagManager.instance.url_for(account)) append_element(author, 'link', nil, rel: :avatar, type: account.avatar_content_type, 'media:width': 120, 'media:height': 120, href: full_asset_url(account.avatar.url(:original))) if account.avatar? append_element(author, 'link', nil, rel: :header, type: account.header_content_type, 'media:width': 700, 'media:height': 335, href: full_asset_url(account.header.url(:original))) if account.header? append_element(author, 'poco:preferredUsername', account.username) @@ -47,7 +47,7 @@ class OStatus::AtomSerializer feed << author(account) - append_element(feed, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(account)) + append_element(feed, 'link', nil, rel: :alternate, type: 'text/html', href: ::TagManager.instance.url_for(account)) append_element(feed, 'link', nil, rel: :self, type: 'application/atom+xml', href: account_url(account, format: 'atom')) append_element(feed, 'link', nil, rel: :next, type: 'application/atom+xml', href: account_url(account, format: 'atom', max_id: stream_entries.last.id)) if stream_entries.size == 20 append_element(feed, 'link', nil, rel: :hub, href: api_push_url) @@ -86,9 +86,9 @@ class OStatus::AtomSerializer serialize_status_attributes(entry, stream_entry.status) end - append_element(entry, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(stream_entry.status)) + append_element(entry, 'link', nil, rel: :alternate, type: 'text/html', href: ::TagManager.instance.url_for(stream_entry.status)) append_element(entry, 'link', nil, rel: :self, type: 'application/atom+xml', href: account_stream_entry_url(stream_entry.account, stream_entry, format: 'atom')) - append_element(entry, 'thr:in-reply-to', nil, ref: OStatus::TagManager.instance.uri_for(stream_entry.thread), href: TagManager.instance.url_for(stream_entry.thread)) if stream_entry.threaded? + append_element(entry, 'thr:in-reply-to', nil, ref: OStatus::TagManager.instance.uri_for(stream_entry.thread), href: ::TagManager.instance.url_for(stream_entry.thread)) if stream_entry.threaded? append_element(entry, 'ostatus:conversation', nil, ref: conversation_uri(stream_entry.status.conversation)) unless stream_entry&.status&.conversation_id.nil? entry @@ -109,8 +109,8 @@ class OStatus::AtomSerializer serialize_status_attributes(object, status) - append_element(object, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(status)) - append_element(object, 'thr:in-reply-to', nil, ref: OStatus::TagManager.instance.uri_for(status.thread), href: TagManager.instance.url_for(status.thread)) unless status.thread.nil? + append_element(object, 'link', nil, rel: :alternate, type: 'text/html', href: ::TagManager.instance.url_for(status)) + append_element(object, 'thr:in-reply-to', nil, ref: OStatus::TagManager.instance.uri_for(status.thread), href: ::TagManager.instance.url_for(status.thread)) unless status.thread.nil? append_element(object, 'ostatus:conversation', nil, ref: conversation_uri(status.conversation)) unless status.conversation_id.nil? object @@ -290,7 +290,7 @@ class OStatus::AtomSerializer entry << object(favourite.status) - append_element(entry, 'thr:in-reply-to', nil, ref: OStatus::TagManager.instance.uri_for(favourite.status), href: TagManager.instance.url_for(favourite.status)) + append_element(entry, 'thr:in-reply-to', nil, ref: OStatus::TagManager.instance.uri_for(favourite.status), href: ::TagManager.instance.url_for(favourite.status)) entry end @@ -312,7 +312,7 @@ class OStatus::AtomSerializer entry << object(favourite.status) - append_element(entry, 'thr:in-reply-to', nil, ref: OStatus::TagManager.instance.uri_for(favourite.status), href: TagManager.instance.url_for(favourite.status)) + append_element(entry, 'thr:in-reply-to', nil, ref: OStatus::TagManager.instance.uri_for(favourite.status), href: ::TagManager.instance.url_for(favourite.status)) entry end |