diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /app/controllers/users | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'app/controllers/users')
-rw-r--r-- | app/controllers/users/unsubscribes_controller.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app/controllers/users/unsubscribes_controller.rb b/app/controllers/users/unsubscribes_controller.rb new file mode 100644 index 00000000000..9ac07083cd5 --- /dev/null +++ b/app/controllers/users/unsubscribes_controller.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Users + class UnsubscribesController < ApplicationController + skip_before_action :authenticate_user! + + feature_category :users + + def show + @user = get_user + end + + def create + @user = get_user + + if @user + @user.admin_unsubscribe! + Notify.send_unsubscribed_notification(@user.id).deliver_later + end + + redirect_to new_user_session_path, notice: 'You have been unsubscribed' + end + + protected + + # rubocop: disable CodeReuse/ActiveRecord + def get_user + @email = Base64.urlsafe_decode64(params[:email]) + User.find_by(email: @email) + end + # rubocop: enable CodeReuse/ActiveRecord + end +end |