From 2dc142bd70797bd00beebc6a5bccbf35d4234d4b Mon Sep 17 00:00:00 2001 From: flaburgan Date: Wed, 5 Jul 2017 09:02:19 +0200 Subject: [PATCH] Add access to the report page on mobile for moderators closes #7479 --- app/views/layouts/_drawer.mobile.haml | 7 +++++++ features/mobile/drawer.feature | 15 +++++++++++++++ features/step_definitions/user_steps.rb | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/app/views/layouts/_drawer.mobile.haml b/app/views/layouts/_drawer.mobile.haml index a9e9efb53..1f248a976 100644 --- a/app/views/layouts/_drawer.mobile.haml +++ b/app/views/layouts/_drawer.mobile.haml @@ -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 diff --git a/features/mobile/drawer.feature b/features/mobile/drawer.feature index fdeca1cc5..42f934581 100644 --- a/features/mobile/drawer.feature +++ b/features/mobile/drawer.feature @@ -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" diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 2338693c3..f01025a07 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -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)