From 6243a7ad07a7a3b955b6ebbd70094a1089cc95b6 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 11 Nov 2015 11:53:24 +0530 Subject: [PATCH] UX: show login screen when anon tries to unsubscribe topic --- app/controllers/topics_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index d1eacdc8916..7848cbb34bc 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -25,8 +25,7 @@ class TopicsController < ApplicationController :reset_new, :change_post_owners, :change_timestamps, - :bookmark, - :unsubscribe] + :bookmark] before_filter :consider_user_for_promotion, only: :show @@ -103,6 +102,11 @@ class TopicsController < ApplicationController end 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) if slugs_do_not_match || (!request.format.json? && params[:slug].blank?)