mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-20 12:32:39 -05:00
239cbd2d58
replaced every `and` by `&&` and every `or` by `||`
30 lines
774 B
Ruby
30 lines
774 B
Ruby
class EmailController < ApplicationController
|
|
skip_before_filter :check_xhr
|
|
layout 'no_js'
|
|
|
|
before_filter :ensure_logged_in, only: :preferences_redirect
|
|
|
|
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
|
|
@user = nil if current_user.present? && (@user != current_user)
|
|
|
|
if @user.present?
|
|
@user.update_column(:email_digests, false)
|
|
else
|
|
@not_found = true
|
|
end
|
|
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
|