0
0
Fork 0

Change featured tag updates to add/remove activity (#19409)

* Change featured tag updates to add/remove activity

* Fix to check for the existence of feature tag

* Rename service and worker

* Merge AddHashtagSerializer with AddSerializer

* Undo removal of sidekiq_options
This commit is contained in:
Takeshi Umeda 2022-10-23 01:30:55 +09:00 committed by GitHub
parent 73a48318a1
commit 74ead7d106
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 117 additions and 15 deletions

View file

@ -10,10 +10,8 @@ class Settings::FeaturedTagsController < Settings::BaseController
end
def create
@featured_tag = current_account.featured_tags.new(featured_tag_params)
if @featured_tag.save
ActivityPub::UpdateDistributionWorker.perform_in(3.minutes, current_account.id)
if !featured_tag_exists?
CreateFeaturedTagService.new.call(current_account, featured_tag_params[:name])
redirect_to settings_featured_tags_path
else
set_featured_tags
@ -24,13 +22,16 @@ class Settings::FeaturedTagsController < Settings::BaseController
end
def destroy
@featured_tag.destroy!
ActivityPub::UpdateDistributionWorker.perform_in(3.minutes, current_account.id)
RemoveFeaturedTagWorker.perform_async(current_account.id, @featured_tag.id)
redirect_to settings_featured_tags_path
end
private
def featured_tag_exists?
current_account.featured_tags.by_name(featured_tag_params[:name]).exists?
end
def set_featured_tag
@featured_tag = current_account.featured_tags.find(params[:id])
end