Add moderation hint below top bar

This commit is contained in:
Christoph Haas 2021-02-24 23:47:30 +01:00
parent ef61db0d11
commit c6bea9b902
3 changed files with 30 additions and 4 deletions

View file

@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base
# Do not mention passwords in the log file
# filter_parameter_logging :password
before_action :get_current_users_screenshots, :debian_sso
before_action :get_current_users_screenshots, :debian_sso, :moderate_packages
# TODO: Deprecation. What is the replacement for Rails.env.development? ?
# Query for packages that were uploaded by the current user.
@ -53,6 +53,15 @@ class ApplicationController < ActionController::Base
end
end
# If the current user is an administrator then show a second bar below
# the navigation bar that contains a paginator of packages that contain
# screenshots that require moderation.
def moderate_packages
if user_signed_in? and current_user.is_admin? and Package.need_moderation.any?
@moderate_packages = Package.need_moderation
end
end
private
# Define where the user is redirected to after a successful login.