Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
liberty
host
Smilodon
Commits
93a90cd9
Commit
93a90cd9
authored
Nov 29, 2016
by
Eugen Rochko
Browse files
Delete statuses asynchronously but provide instant feedback in the API
parent
5973ca3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/controllers/api/v1/statuses_controller.rb
View file @
93a90cd9
...
...
@@ -58,7 +58,7 @@ class Api::V1::StatusesController < ApiController
def
destroy
@status
=
Status
.
where
(
account_id:
current_user
.
account
).
find
(
params
[
:id
])
Remov
eStatusService
.
new
.
call
(
@status
)
Remov
alWorker
.
perform_async
(
@status
.
id
)
render_empty
end
...
...
@@ -68,8 +68,12 @@ class Api::V1::StatusesController < ApiController
end
def
unreblog
RemoveStatusService
.
new
.
call
(
Status
.
where
(
account_id:
current_user
.
account
,
reblog_of_id:
params
[
:id
]).
first!
)
@status
=
Status
.
find
(
params
[
:id
])
reblog
=
Status
.
where
(
account_id:
current_user
.
account
,
reblog_of_id:
params
[
:id
]).
first!
@status
=
reblog
.
reblog
@reblogged_map
=
{
@status
.
id
=>
false
}
RemovalWorker
.
perform_async
(
reblog
.
id
)
render
action: :show
end
...
...
app/workers/removal_worker.rb
0 → 100644
View file @
93a90cd9
# frozen_string_literal: true
class
RemovalWorker
include
Sidekiq
::
Worker
def
perform
(
status_id
)
RemoveStatusService
.
new
.
call
(
Status
.
find
(
status_id
))
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment