diff --git a/app/policies/dashboard_policy.rb b/app/policies/dashboard_policy.rb
deleted file mode 100644
index 13b7f92d15..0000000000
--- a/app/policies/dashboard_policy.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class DashboardPolicy < ApplicationPolicy
- VIEW_INBOX_ROLES = %w[superadmin policy_and_abuse].freeze
-
- def can_view_inbox_link?
- user_has_roles?(VIEW_INBOX_ROLES)
- end
-end
diff --git a/app/views/users/_sidebar.html.erb b/app/views/users/_sidebar.html.erb
index c4c1849531..a6a8a0295d 100644
--- a/app/views/users/_sidebar.html.erb
+++ b/app/views/users/_sidebar.html.erb
@@ -35,7 +35,7 @@
<%= span_if_current t(".pitch.collections", coll_number: @user.maintained_collections.count), user_collections_path(@user) %>
-<% if @user == current_user || policy(:dashboard).can_view_inbox_link? %>
+<% if @user == current_user || policy(:inbox_comment).show? %>
<%= t(".landmark.catch") %>
- <%= span_if_current t(".catch.inbox", inbox_number: @user.unread_inbox_comments_count.to_s), user_inbox_path(@user) %>
diff --git a/spec/controllers/inbox_controller_spec.rb b/spec/controllers/inbox_controller_spec.rb
index 68551d0b3e..9e29317db9 100644
--- a/spec/controllers/inbox_controller_spec.rb
+++ b/spec/controllers/inbox_controller_spec.rb
@@ -20,8 +20,8 @@
end
context "when logged in as an admin" do
- context "when admin does not have correct authorization" do
- context "when admin has no role" do
+ context "when the admin does not have the correct authorization" do
+ context "when the admin has no role" do
let(:admin) { create(:admin, roles: []) }
before { fake_login_admin(admin) }
@@ -34,7 +34,7 @@
end
(Admin::VALID_ROLES - %w[superadmin policy_and_abuse]).each do |role|
- context "when admin has #{role} role" do
+ context "when the admin has the #{role} role" do
let(:admin) { create(:admin, roles: [role]) }
before { fake_login_admin(admin) }
@@ -49,7 +49,7 @@
end
%w[superadmin policy_and_abuse].each do |role|
- context "when admin is authorized with the #{role} role" do
+ context "when the admin is authorized with the #{role} role" do
let(:admin) { create(:admin, roles: [role]) }
before { fake_login_admin(admin) }
@@ -114,7 +114,7 @@
let(:inbox_comment) { create(:inbox_comment, user: user) }
it "excludes deleted comments" do
- inbox_comment.feedback_comment.destroy
+ inbox_comment.feedback_comment.destroy!
get :show, params: { user_id: user.login }
expect(assigns(:inbox_total)).to eq(0)
expect(assigns(:unread)).to eq(0)
@@ -187,7 +187,7 @@
let(:inbox_comment) { create(:inbox_comment, user: user) }
it "excludes deleted comments" do
- inbox_comment.feedback_comment.destroy
+ inbox_comment.feedback_comment.destroy!
get :show, params: { user_id: user.login }
expect(assigns(:inbox_total)).to eq(0)
expect(assigns(:unread)).to eq(0)
@@ -267,7 +267,7 @@
end
end
- context "when logged in as the same user" do
+ context "when logged in as the comment receiver" do
before { fake_login_known_user(user) }
context "with no comments selected" do