mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-13 21:29:59 +01:00
Add detail view for reports
This commit is contained in:
parent
432a5239d5
commit
369d94824f
4 changed files with 47 additions and 0 deletions
|
@ -18,6 +18,10 @@ class Moderation::ReportsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@report = Report.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def filter_params
|
def filter_params
|
||||||
|
|
3
app/views/moderation/reports/show.html.haml
Normal file
3
app/views/moderation/reports/show.html.haml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
= render "moderation/moderationbox", report: @report
|
||||||
|
|
||||||
|
- parent_layout "moderation"
|
|
@ -26,6 +26,7 @@ Rails.application.routes.draw do
|
||||||
post "/moderation/unmask", to: "moderation#toggle_unmask", as: :moderation_toggle_unmask
|
post "/moderation/unmask", to: "moderation#toggle_unmask", as: :moderation_toggle_unmask
|
||||||
get "/moderation/blocks", to: "moderation/anonymous_block#index", as: :mod_anon_block_index
|
get "/moderation/blocks", to: "moderation/anonymous_block#index", as: :mod_anon_block_index
|
||||||
get "/moderation/inbox/:user", to: "moderation/inbox#index", as: :mod_inbox_index
|
get "/moderation/inbox/:user", to: "moderation/inbox#index", as: :mod_inbox_index
|
||||||
|
get "/moderation/report/:id", to: "moderation/reports#show", as: :moderation_report
|
||||||
get "/moderation/reports(/:type)", to: "moderation/reports#index", as: :moderation_reports
|
get "/moderation/reports(/:type)", to: "moderation/reports#index", as: :moderation_reports
|
||||||
get "/moderation/questions/:author_identifier", to: "moderation/questions#show", as: :moderation_questions
|
get "/moderation/questions/:author_identifier", to: "moderation/questions#show", as: :moderation_questions
|
||||||
namespace :ajax do
|
namespace :ajax do
|
||||||
|
|
|
@ -118,4 +118,43 @@ describe Moderation::ReportsController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#show" do
|
||||||
|
shared_examples_for "sets the expected ivars" do
|
||||||
|
let(:expected_assigns) { {} }
|
||||||
|
|
||||||
|
it "sets the expected ivars" do
|
||||||
|
subject
|
||||||
|
|
||||||
|
expected_assigns.each do |name, value|
|
||||||
|
expect(assigns[name]).to eq(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "template rendering" do
|
||||||
|
let(:other_user) { FactoryBot.create :user }
|
||||||
|
let(:report) { Report.create(user:, target_id: other_user.id, type: "Reports::User") }
|
||||||
|
|
||||||
|
subject { get :show, params: { id: report.id } }
|
||||||
|
|
||||||
|
before do
|
||||||
|
report
|
||||||
|
sign_in user
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders the moderation/reports/show template" do
|
||||||
|
subject
|
||||||
|
expect(response).to render_template("moderation/reports/show")
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples "sets the expected ivars" do
|
||||||
|
let(:expected_assigns) do
|
||||||
|
{
|
||||||
|
report:
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue