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
42eeecba
Commit
42eeecba
authored
9 years ago
by
Eugen Rochko
Browse files
Options
Downloads
Patches
Plain Diff
Service to reblog statuses
parent
c967802c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/services/post_status_service.rb
+7
-0
7 additions, 0 deletions
app/services/post_status_service.rb
app/services/reblog_service.rb
+18
-0
18 additions, 0 deletions
app/services/reblog_service.rb
with
25 additions
and
0 deletions
app/services/post_status_service.rb
+
7
−
0
View file @
42eeecba
class
PostStatusService
<
BaseService
# Post a text status update, fetch and notify remote users mentioned
# @param [Account] account Account from which to post
# @param [String] text Message
# @param [Status] in_reply_to Optional status to reply to
# @return [Status]
def
call
(
account
,
text
,
in_reply_to
=
nil
)
status
=
account
.
statuses
.
create!
(
text:
text
,
thread:
in_reply_to
)
...
...
@@ -14,6 +19,8 @@ class PostStatusService < BaseService
next
if
mentioned_account
.
local?
send_interaction_service
.
(
status
.
stream_entry
,
mentioned_account
)
end
status
end
private
...
...
This diff is collapsed.
Click to expand it.
app/services/reblog_service.rb
0 → 100644
+
18
−
0
View file @
42eeecba
class
ReblogService
<
BaseService
# Reblog a status and notify its remote author
# @param [Account] account Account to reblog from
# @param [Status] reblogged_status Status to be reblogged
# @return [Status]
def
call
(
account
,
reblogged_status
)
reblog
=
account
.
statuses
.
create!
(
reblog:
reblogged_status
,
text:
''
)
return
reblog
if
reblogged_status
.
local?
send_interaction_service
.
(
reblog
.
stream_entry
,
reblogged_status
.
account
)
reblog
end
private
def
send_interaction_service
@send_interaction_service
||=
SendInteractionService
.
new
end
end
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