Fix #4670: Replace RequestStore with AS::CurrentAttributes.

This also requires replacing CurrentUser.name with CurrentUser.user.name
because the `name` method had a conflict with CurrentAttributes.
This commit is contained in:
evazion
2021-01-16 12:43:20 -06:00
parent 6f6ec6592d
commit 6ca007ee1f
11 changed files with 32 additions and 91 deletions

View File

@@ -47,7 +47,7 @@ class FavoriteGroupsController < ApplicationController
@favorite_group = authorize FavoriteGroup.find(params[:id])
@favorite_group.destroy!
flash[:notice] = "Favorite group deleted" if request.format.html?
respond_with(@favorite_group, location: favorite_groups_path(search: { creator_name: CurrentUser.name }))
respond_with(@favorite_group, location: favorite_groups_path(search: { creator_name: CurrentUser.user.name }))
end
def add_post

View File

@@ -12,7 +12,7 @@ class FavoritesController < ApplicationController
user = User.find(params[:user_id])
redirect_to posts_path(tags: "ordfav:#{user.name}", format: request.format.symbol)
elsif !CurrentUser.is_anonymous?
redirect_to posts_path(tags: "ordfav:#{CurrentUser.name}", format: request.format.symbol)
redirect_to posts_path(tags: "ordfav:#{CurrentUser.user.name}", format: request.format.symbol)
else
redirect_to posts_path(format: request.format.symbol)
end

View File

@@ -7,7 +7,7 @@ class UserNameChangeRequestsController < ApplicationController
end
def create
@change_request = authorize UserNameChangeRequest.new(user: CurrentUser.user, original_name: CurrentUser.name)
@change_request = authorize UserNameChangeRequest.new(user: CurrentUser.user, original_name: CurrentUser.user.name)
@change_request.update(permitted_attributes(@change_request))
flash[:notice] = "Your name has been changed" if @change_request.valid?
respond_with(@change_request, location: profile_path)