mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Handle delete Salmons, todo: clean up timelines
This commit is contained in:
parent
1022d682dc
commit
a289c1d52f
4 changed files with 115 additions and 1 deletions
|
@ -91,7 +91,7 @@ class ProcessFeedService < BaseService
|
|||
end
|
||||
|
||||
def delete_post!(status)
|
||||
status.destroy!
|
||||
RemoveStatusService.new.(status)
|
||||
end
|
||||
|
||||
def find_original_status(_xml, id)
|
||||
|
|
|
@ -32,6 +32,8 @@ class ProcessInteractionService < BaseService
|
|||
add_post!(body, account) if mentions_account?(xml, target_account)
|
||||
when :share
|
||||
add_post!(body, account) unless status(xml).nil?
|
||||
when :delete
|
||||
delete_post!(xml, account)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -62,6 +64,16 @@ class ProcessInteractionService < BaseService
|
|||
account.unfollow!(target_account)
|
||||
end
|
||||
|
||||
def delete_post!(xml, account)
|
||||
status = Status.find(activity_id(xml))
|
||||
|
||||
return if status.nil?
|
||||
|
||||
if account.id == status.account_id
|
||||
RemoveStatusService.new.(status)
|
||||
end
|
||||
end
|
||||
|
||||
def favourite!(xml, from_account)
|
||||
current_status = status(xml)
|
||||
current_status.favourites.where(account: from_account).first_or_create!(account: from_account)
|
||||
|
|
10
app/services/remove_status_service.rb
Normal file
10
app/services/remove_status_service.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class RemoveStatusService < BaseService
|
||||
def call(status)
|
||||
status.destroy!
|
||||
|
||||
# TODO
|
||||
# Remove from timelines of self, followers, and mentioned accounts
|
||||
# For remote mentioned accounts, send delete Salmon
|
||||
# Push delete event through ActionCable
|
||||
end
|
||||
end
|
92
spec/fixtures/push/reblog.atom
vendored
Normal file
92
spec/fixtures/push/reblog.atom
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:georss="http://www.georss.org/georss" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:media="http://purl.org/syndication/atommedia" xmlns:statusnet="http://status.net/schema/api/1/">
|
||||
<id>tag:gs.smuglo.li,2016-09-03:noticeId=661684:objectType=note</id>
|
||||
<title>dtluna repeated a notice by gargron</title>
|
||||
<content type="html">RT @<a href="https://mastodon.social/users/Gargron" class="h-card mention" title="Eugen">gargron</a> Stormbending from Devin Townsend's upcoming album Transcendence is now on YouTube <a href="https://www.youtube.com/watch?v=8s9qh77gj6Y" title="https://www.youtube.com/watch?v=8s9qh77gj6Y" class="attachment thumbnail" id="attachment-122081" rel="nofollow external">https://www.youtube.com/watch?v=8s9qh77gj6Y</a></content>
|
||||
<link rel="alternate" type="text/html" href="https://gs.smuglo.li/notice/661684"/>
|
||||
<activity:verb>http://activitystrea.ms/schema/1.0/share</activity:verb>
|
||||
<published>2016-09-03T13:48:19+00:00</published>
|
||||
<updated>2016-09-03T13:48:19+00:00</updated>
|
||||
<author>
|
||||
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
|
||||
<uri>https://gs.smuglo.li/user/537</uri>
|
||||
<name>dtluna</name>
|
||||
<summary>Sex Goddess of Fediverse. Parabola GNU/Linux-libre user. PGP: 0xA490DBE4 XMPP and email: dtluna@memeware.net</summary>
|
||||
<link rel="alternate" type="text/html" href="https://gs.smuglo.li/dtluna"/>
|
||||
<link rel="avatar" type="image/jpeg" media:width="385" media:height="385" href="https://gs.smuglo.li/avatar/537-original-20160807184048.jpeg"/>
|
||||
<link rel="avatar" type="image/jpeg" media:width="96" media:height="96" href="https://gs.smuglo.li/avatar/537-96-20160807184048.jpeg"/>
|
||||
<link rel="avatar" type="image/jpeg" media:width="48" media:height="48" href="https://gs.smuglo.li/avatar/537-48-20160807184048.jpeg"/>
|
||||
<link rel="avatar" type="image/jpeg" media:width="24" media:height="24" href="https://gs.smuglo.li/avatar/537-24-20160807184049.jpeg"/>
|
||||
<poco:preferredUsername>dtluna</poco:preferredUsername>
|
||||
<poco:displayName>dtluna</poco:displayName>
|
||||
<poco:note>Sex Goddess of Fediverse. Parabola GNU/Linux-libre user. PGP: 0xA490DBE4 XMPP and email: dtluna@memeware.net</poco:note>
|
||||
<poco:address>
|
||||
<poco:formatted>Minsk, Belarus</poco:formatted>
|
||||
</poco:address>
|
||||
<poco:urls>
|
||||
<poco:type>homepage</poco:type>
|
||||
<poco:value>https://liberapay.com/dtluna/</poco:value>
|
||||
<poco:primary>true</poco:primary>
|
||||
</poco:urls>
|
||||
<followers url="https://gs.smuglo.li/dtluna/subscribers"></followers>
|
||||
<statusnet:profile_info local_id="537"></statusnet:profile_info>
|
||||
</author>
|
||||
<activity:object>
|
||||
<activity:object-type>http://activitystrea.ms/schema/1.0/activity</activity:object-type>
|
||||
<id>tag:mastodon.social,2016-09-03:objectId=5984:objectType=Status</id>
|
||||
<title></title>
|
||||
<content type="html">Stormbending from Devin Townsend's upcoming album Transcendence is now on YouTube <a rel="nofollow" href="https://www.youtube.com/watch?v=8s9qh77gj6Y">https://www.youtube.com/watch?v=8s9qh77gj6Y</a></content>
|
||||
<link rel="alternate" type="text/html" href="https://mastodon.social/users/Gargron/updates/6066"/>
|
||||
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
|
||||
<published>2016-09-03T13:47:59+00:00</published>
|
||||
<updated>2016-09-03T13:47:59+00:00</updated>
|
||||
<author>
|
||||
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
|
||||
<uri>https://mastodon.social/users/Gargron</uri>
|
||||
<name>gargron</name>
|
||||
<summary>Software engineer, free time musician and DIGITAL SPORTS enthusiast. Likes cats. Warning: May contain memes</summary>
|
||||
<link rel="alternate" type="text/html" href="https://mastodon.social/users/Gargron"/>
|
||||
<link rel="avatar" type="image/gif" media:width="96" media:height="96" href="https://gs.smuglo.li/avatar/1292-original-20160903122640.gif"/>
|
||||
<link rel="avatar" type="image/gif" media:width="96" media:height="96" href="https://gs.smuglo.li/avatar/1292-original-20160903122640.gif"/>
|
||||
<link rel="avatar" type="image/gif" media:width="48" media:height="48" href="https://gs.smuglo.li/avatar/1292-48-20160903122642.gif"/>
|
||||
<link rel="avatar" type="image/gif" media:width="24" media:height="24" href="https://gs.smuglo.li/avatar/1292-24-20160903122736.gif"/>
|
||||
<poco:preferredUsername>gargron</poco:preferredUsername>
|
||||
<poco:displayName>Eugen</poco:displayName>
|
||||
<poco:note>Software engineer, free time musician and DIGITAL SPORTS enthusiast. Likes cats. Warning: May contain memes</poco:note>
|
||||
<statusnet:profile_info local_id="1292"></statusnet:profile_info>
|
||||
</author>
|
||||
<activity:object>
|
||||
<activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
|
||||
<id>tag:mastodon.social,2016-09-03:objectId=5984:objectType=Status</id>
|
||||
<title>New note by gargron</title>
|
||||
<content type="html">Stormbending from Devin Townsend's upcoming album Transcendence is now on YouTube <a rel="nofollow" href="https://www.youtube.com/watch?v=8s9qh77gj6Y">https://www.youtube.com/watch?v=8s9qh77gj6Y</a></content>
|
||||
<link rel="alternate" type="text/html" href="https://mastodon.social/users/Gargron/updates/6066"/>
|
||||
<status_net notice_id="661682"></status_net>
|
||||
</activity:object>
|
||||
<link rel="ostatus:conversation" href="tag:gs.smuglo.li,2016-09-03:objectType=thread:nonce=aec0feafff16e2cf"/>
|
||||
<ostatus:conversation>tag:gs.smuglo.li,2016-09-03:objectType=thread:nonce=aec0feafff16e2cf</ostatus:conversation>
|
||||
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
|
||||
<source>
|
||||
<id>https://mastodon.social/users/Gargron.atom</id>
|
||||
<title>Eugen</title>
|
||||
<link rel="alternate" type="text/html" href="https://mastodon.social/users/Gargron"/>
|
||||
<link rel="self" type="application/atom+xml" href="https://mastodon.social/users/Gargron.atom"/>
|
||||
<icon>https://gs.smuglo.li/avatar/1292-original-20160903122640.gif</icon>
|
||||
<updated>2016-09-04T12:10:44+00:00</updated>
|
||||
</source>
|
||||
</activity:object>
|
||||
<link rel="ostatus:conversation" href="tag:gs.smuglo.li,2016-09-03:objectType=thread:nonce=aec0feafff16e2cf"/>
|
||||
<ostatus:conversation>tag:gs.smuglo.li,2016-09-03:objectType=thread:nonce=aec0feafff16e2cf</ostatus:conversation>
|
||||
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
|
||||
<source>
|
||||
<id>https://gs.smuglo.li/api/statuses/user_timeline/537.atom</id>
|
||||
<title>dtluna</title>
|
||||
<link rel="alternate" type="text/html" href="https://gs.smuglo.li/dtluna"/>
|
||||
<link rel="self" type="application/atom+xml" href="https://gs.smuglo.li/api/statuses/user_timeline/537.atom"/>
|
||||
<link rel="license" href="https://creativecommons.org/licenses/by/3.0/"/>
|
||||
<icon>https://gs.smuglo.li/avatar/537-96-20160807184048.jpeg</icon>
|
||||
<updated>2016-09-04T01:48:58+00:00</updated>
|
||||
</source>
|
||||
<link rel="self" type="application/atom+xml" href="https://gs.smuglo.li/api/statuses/show/661684.atom"/>
|
||||
<link rel="edit" type="application/atom+xml" href="https://gs.smuglo.li/api/statuses/show/661684.atom"/>
|
||||
<statusnet:notice_info local_id="661684" source="Qvitter" repeat_of="661682"></statusnet:notice_info>
|
||||
</entry>
|
Loading…
Reference in a new issue