related tags: eliminate recent_tags cookie (#3955).
This commit is contained in:
@@ -46,7 +46,6 @@ class PostsController < ApplicationController
|
||||
@post = Post.find(params[:id])
|
||||
|
||||
@post.update(post_params) if @post.visible?
|
||||
save_recent_tags
|
||||
respond_with_post_after_update(@post)
|
||||
end
|
||||
|
||||
@@ -96,15 +95,6 @@ private
|
||||
params[:tags] || (params[:post] && params[:post][:tags])
|
||||
end
|
||||
|
||||
def save_recent_tags
|
||||
if @post
|
||||
tags = Tag.scan_tags(@post.tag_string)
|
||||
tags = (TagAlias.to_aliased(tags) + Tag.scan_tags(cookies[:recent_tags])).uniq.slice(0, 30)
|
||||
cookies[:recent_tags] = tags.join(" ")
|
||||
cookies[:recent_tags_with_categories] = Tag.categories_for(tags).to_a.flatten.join(" ")
|
||||
end
|
||||
end
|
||||
|
||||
def respond_with_post_after_update(post)
|
||||
respond_with(post) do |format|
|
||||
format.html do
|
||||
|
||||
@@ -58,21 +58,11 @@ class UploadsController < ApplicationController
|
||||
flash[:notice] = @service.warnings.join(".\n \n")
|
||||
end
|
||||
|
||||
save_recent_tags
|
||||
respond_with(@upload)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def save_recent_tags
|
||||
if @upload
|
||||
tags = Tag.scan_tags(@upload.tag_string)
|
||||
tags = (TagAlias.to_aliased(tags) + Tag.scan_tags(cookies[:recent_tags])).compact.uniq.slice(0, 30)
|
||||
cookies[:recent_tags] = tags.join(" ")
|
||||
cookies[:recent_tags_with_categories] = Tag.categories_for(tags).to_a.flatten.join(" ")
|
||||
end
|
||||
end
|
||||
|
||||
def upload_params
|
||||
permitted_params = %i[
|
||||
file source tag_string rating status parent_id artist_commentary_title
|
||||
|
||||
Reference in New Issue
Block a user