add link for migrating tag subscription to saved search

This commit is contained in:
r888888888
2016-06-15 13:39:16 -07:00
parent 3e3f90d79a
commit 4622656abb
4 changed files with 12 additions and 0 deletions

View File

@@ -61,6 +61,14 @@ class TagSubscriptionsController < ApplicationController
@posts = @post_set.posts
end
def migrate
@tag_subscription = TagSubscription.find(params[:id])
check_privilege(@tag_subscription)
@tag_subscription.migrate_to_saved_searches
flash[:notice] = "Tag subscription will be migrated to a saved search. Please wait a few minutes for the search to refresh."
redirect_to tag_subscriptions_path
end
private
def check_privilege(tag_subscription)
raise User::PrivilegeError unless tag_subscription.editable_by?(CurrentUser.user)