Add access to the report page on mobile for moderators

closes #7479
This commit is contained in:
flaburgan 2017-07-05 09:02:19 +02:00 committed by Benjamin Neff
parent 59c343c0c6
commit 2dc142bd70
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
3 changed files with 27 additions and 0 deletions

View file

@ -52,5 +52,12 @@
= t("admins.admin_bar.report")
%li= link_to t("admins.admin_bar.pod_network"), admin_pods_path
%li= link_to t("admins.admin_bar.sidekiq_monitor"), sidekiq_path
- elsif current_user.moderator?
%li
%a{href: report_index_path}
- if unreviewed_reports_count > 0
.pull-right.badge
= unreviewed_reports_count
= t("admins.admin_bar.report")
%li= link_to t("layouts.application.toggle"), toggle_mobile_path
%li= link_to t("layouts.header.logout"), destroy_user_session_path, method: :delete

View file

@ -106,10 +106,20 @@ Feature: Navigate between pages using the header menu and the drawer
And I click on "Settings" in the drawer
Then I should be on my account settings page
Scenario: navigate to the moderation page
Given a moderator with email "bob@bob.bob"
And I sign in as "bob@bob.bob" on the mobile website
When I open the drawer
Then I should not see "Admin" within "#drawer"
And I should see "Reports" within "#drawer"
When I click on "Reports" in the drawer
Then I should see "Reports overview" within "#main h1"
Scenario: navigate to the admin pages
Given an admin with email "bob@bob.bob"
And I sign in as "bob@bob.bob" on the mobile website
When I open the drawer
Then I should not see "Reports" within "#drawer"
Then I should not see "Dashboard" within "#drawer"
When I click on "Admin" in the drawer
And I click on "Dashboard" in the drawer
@ -131,3 +141,8 @@ Feature: Navigate between pages using the header menu and the drawer
Then I should see "Pod network " within "#main h2"
When I click on "Admin" in the drawer
Then I should see "Sidekiq monitor" within "#drawer"
Scenario: users doesn't have access to the admin pages
When I open the drawer
Then I should not see "Admin" within "#drawer"
Then I should not see "Reports" within "#drawer"

View file

@ -25,6 +25,11 @@ Given /^a nsfw user with email "([^\"]*)"$/ do |email|
user.profile.update_attributes(:nsfw => true)
end
Given /^a moderator with email "([^\"]*)"$/ do |email|
user = create_user(email: email)
Role.add_moderator(user)
end
Given /^an admin with email "([^\"]*)"$/ do |email|
user = create_user(email: email)
Role.add_admin(user)