UX: show login screen when anon tries to unsubscribe topic

This commit is contained in:
Arpit Jalan 2015-11-11 11:53:24 +05:30
parent 42bf8151b2
commit 6243a7ad07
1 changed files with 6 additions and 2 deletions

View File

@ -25,8 +25,7 @@ class TopicsController < ApplicationController
:reset_new, :reset_new,
:change_post_owners, :change_post_owners,
:change_timestamps, :change_timestamps,
:bookmark, :bookmark]
:unsubscribe]
before_filter :consider_user_for_promotion, only: :show before_filter :consider_user_for_promotion, only: :show
@ -103,6 +102,11 @@ class TopicsController < ApplicationController
end end
def unsubscribe def unsubscribe
if current_user.blank?
cookies[:destination_url] = request.fullpath
return redirect_to "/login-preferences"
end
@topic_view = TopicView.new(params[:topic_id], current_user) @topic_view = TopicView.new(params[:topic_id], current_user)
if slugs_do_not_match || (!request.format.json? && params[:slug].blank?) if slugs_do_not_match || (!request.format.json? && params[:slug].blank?)