mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
FIX: moderators couldn't see flagged topics list
This commit is contained in:
parent
b2127600fb
commit
beca02c046
@ -193,7 +193,7 @@ Discourse::Application.routes.draw do
|
||||
post "flags/disagree/:id" => "flags#disagree"
|
||||
post "flags/defer/:id" => "flags#defer"
|
||||
|
||||
resources :flagged_topics, constraints: AdminConstraint.new
|
||||
resources :flagged_topics, constraints: StaffConstraint.new
|
||||
resources :themes, constraints: AdminConstraint.new
|
||||
|
||||
post "themes/import" => "themes#import"
|
||||
|
@ -1,19 +1,33 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::FlaggedTopicsController do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
let!(:flag) { Fabricate(:flag) }
|
||||
|
||||
before do
|
||||
sign_in(admin)
|
||||
shared_examples "successfully retrieve list of flagged topics" do
|
||||
it "returns a list of flagged topics" do
|
||||
get "/admin/flagged_topics.json"
|
||||
expect(response).to be_success
|
||||
|
||||
data = ::JSON.parse(response.body)
|
||||
expect(data['flagged_topics']).to be_present
|
||||
expect(data['users']).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
it "returns a list of flagged topics" do
|
||||
get "/admin/flagged_topics.json"
|
||||
expect(response).to be_success
|
||||
context "as admin" do
|
||||
before do
|
||||
sign_in(Fabricate(:admin))
|
||||
end
|
||||
|
||||
data = ::JSON.parse(response.body)
|
||||
expect(data['flagged_topics']).to be_present
|
||||
expect(data['users']).to be_present
|
||||
include_examples "successfully retrieve list of flagged topics"
|
||||
end
|
||||
|
||||
context "as moderator" do
|
||||
before do
|
||||
sign_in(Fabricate(:moderator))
|
||||
end
|
||||
|
||||
include_examples "successfully retrieve list of flagged topics"
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user