Skip to content

Commit

Permalink
Fix rubocop complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
WelpThatWorked committed Dec 23, 2024
1 parent 17f68ba commit 7231627
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/controllers/tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ def show
@page_subtitle = @tag.name
if @tag.is_a?(Banned)
if !logged_in_as_admin?
flash[:error] = ts('Please log in as admin')
flash[:error] = t("admin.access.not_admin_denied")
redirect_to(tag_wranglings_path) && return
elsif !policy(:wrangling).read_access?
flash[:error] = ts('Sorry, only an authorized admin can access the page you were trying to reach.')
flash[:error] = t("admin.access.page_access_denied")
redirect_to(root_path) && return
end
end
# if tag is NOT wrangled, prepare to show works and bookmarks that are using it
if !@tag.canonical && !@tag.merger
if logged_in? # current_user.is_a?User
@works = @tag.works.visible_to_registered_user.paginate(page: params[:page])
elsif logged_in_as_admin?
@works = @tag.works.visible_to_admin.paginate(page: params[:page])
else
@works = @tag.works.visible_to_all.paginate(page: params[:page])
end
@works = if logged_in? # current_user.is_a?User
@tag.works.visible_to_registered_user.paginate(page: params[:page])
elsif logged_in_as_admin?
@tag.works.visible_to_admin.paginate(page: params[:page])
else
@tag.works.visible_to_all.paginate(page: params[:page])
end
@bookmarks = @tag.bookmarks.visible.paginate(page: params[:page])
end
# cache the children, since it's a possibly massive query
Expand Down
1 change: 1 addition & 0 deletions config/locales/controllers/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ en:
admin:
access:
action_access_denied: Sorry, only an authorized admin can do that.
not_admin_denied: Please log in as admin
page_access_denied: Sorry, only an authorized admin can access the page you were trying to reach.
admin_invitations:
find:
Expand Down

0 comments on commit 7231627

Please sign in to comment.