From 1ae21d51bc87ed34c5c17522eb8f41912cae3af5 Mon Sep 17 00:00:00 2001 From: albert Date: Mon, 11 Mar 2013 13:50:35 -0400 Subject: [PATCH] fixes #843 --- app/controllers/uploads_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index ec90baf29..2f2ecf793 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -1,5 +1,6 @@ class UploadsController < ApplicationController before_filter :member_only + after_filter :save_recent_tags, :only => [:create] respond_to :html, :xml, :json, :js rescue_from Upload::Error, :with => :rescue_exception @@ -43,4 +44,13 @@ class UploadsController < ApplicationController @upload.process! respond_with(@upload) end + +protected + def save_recent_tags + if @upload + tags = Tag.scan_tags(@upload.tag_string) + tags = TagAlias.to_aliased(tags) + Tag.scan_tags(cookies[:recent_tags]) + cookies[:recent_tags] = tags.uniq.slice(0, 40).join(" ") + end + end end