Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
c04002b3
Commit
c04002b3
authored
8 years ago
by
Eugen Rochko
Browse files
Options
Downloads
Patches
Plain Diff
Federate blocks with the
http://mastodon.social/schema/1.0
verb namespace
parent
9f9e11ce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/lib/tag_manager.rb
+2
-0
2 additions, 0 deletions
app/lib/tag_manager.rb
app/services/block_service.rb
+3
-1
3 additions, 1 deletion
app/services/block_service.rb
app/services/process_interaction_service.rb
+13
-0
13 additions, 0 deletions
app/services/process_interaction_service.rb
with
18 additions
and
1 deletion
app/lib/tag_manager.rb
+
2
−
0
View file @
c04002b3
...
...
@@ -14,6 +14,8 @@ class TagManager
delete:
'http://activitystrea.ms/schema/1.0/delete'
,
follow:
'http://activitystrea.ms/schema/1.0/follow'
,
unfollow:
'http://ostatus.org/schema/1.0/unfollow'
,
block:
'http://mastodon.social/schema/1.0/block'
,
unblock:
'http://mastodon.social/schema/1.0/unblock'
,
}.
freeze
TYPES
=
{
...
...
This diff is collapsed.
Click to expand it.
app/services/block_service.rb
+
3
−
1
View file @
c04002b3
...
...
@@ -7,10 +7,12 @@ class BlockService < BaseService
UnfollowService
.
new
.
call
(
account
,
target_account
)
if
account
.
following?
(
target_account
)
UnfollowService
.
new
.
call
(
target_account
,
account
)
if
target_account
.
following?
(
account
)
account
.
block!
(
target_account
)
block
=
account
.
block!
(
target_account
)
clear_timelines
(
account
,
target_account
)
clear_notifications
(
account
,
target_account
)
NotificationWorker
.
perform_async
(
block
.
stream_entry
.
id
,
target_account
.
id
)
unless
target_account
.
local?
end
private
...
...
This diff is collapsed.
Click to expand it.
app/services/process_interaction_service.rb
+
13
−
0
View file @
c04002b3
...
...
@@ -41,6 +41,10 @@ class ProcessInteractionService < BaseService
add_post!
(
body
,
account
)
unless
status
(
xml
).
nil?
when
:delete
delete_post!
(
xml
,
account
)
when
:block
reflect_block!
(
account
,
target_account
)
when
:unblock
reflect_unblock!
(
account
,
target_account
)
end
end
rescue
Goldfinger
::
Error
,
HTTP
::
Error
,
OStatus2
::
BadSalmonError
...
...
@@ -74,6 +78,15 @@ class ProcessInteractionService < BaseService
account
.
unfollow!
(
target_account
)
end
def
reflect_block!
(
account
,
target_account
)
UnfollowService
.
new
.
call
(
target_account
,
account
)
if
target_account
.
following?
(
account
)
account
.
block!
(
target_account
)
end
def
reflect_unblock!
(
account
,
target_account
)
UnblockService
.
new
.
call
(
account
,
target_account
)
end
def
delete_post!
(
xml
,
account
)
status
=
Status
.
find
(
xml
.
at_xpath
(
'//xmlns:id'
,
xmlns:
TagManager
::
XMLNS
).
content
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment