mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 00:54:21 +08:00
987504c6ab
While *sometimes* `no_js` was used for visitors without js (for example disabling it on your browser) it was also used for some pages that were disabled to JS capable browsers, including the 404 page. Even worse, sometimes it was used on pages that *had* Javascript, such as our `/activate-account` route. It has been renamed to `no_ember` to indicate what it really is, a layout for the site that doesn't load our Ember.js application.
37 lines
888 B
Ruby
37 lines
888 B
Ruby
class EmailController < ApplicationController
|
|
skip_before_filter :check_xhr
|
|
layout 'no_ember'
|
|
|
|
before_filter :ensure_logged_in, only: :preferences_redirect
|
|
skip_before_filter :redirect_to_login_if_required
|
|
|
|
def preferences_redirect
|
|
redirect_to(email_preferences_path(current_user.username_lower))
|
|
end
|
|
|
|
def unsubscribe
|
|
@user = User.find_by_temporary_key(params[:key])
|
|
|
|
# Don't allow the use of a key while logged in as a different user
|
|
if current_user.present? && (@user != current_user)
|
|
@different_user = true
|
|
return
|
|
end
|
|
|
|
if @user.blank?
|
|
@not_found = true
|
|
return
|
|
end
|
|
|
|
@user.update_column(:email_digests, false)
|
|
@success = true
|
|
end
|
|
|
|
def resubscribe
|
|
@user = User.find_by_temporary_key(params[:key])
|
|
raise Discourse::NotFound unless @user.present?
|
|
@user.update_column(:email_digests, true)
|
|
end
|
|
|
|
end
|