Clarify flags from deletions in the deletion/flag log

This commit is contained in:
Kira 2019-08-01 14:49:58 -07:00
parent cef4d5df1d
commit 1d09ff5440
5 changed files with 11 additions and 4 deletions

View File

@ -5,6 +5,7 @@ module PostFlagsHelper
post.flags.each do |flag|
html << '<li>'
html << (flag.is_deletion ? "[DELETION] " : "[FLAG] ")
html << format_text(flag.reason, inline: true)
if CurrentUser.can_view_flagger_on_post?(flag)

View File

@ -17,7 +17,6 @@ class PostFlag < ApplicationRecord
validate :validate_post
validates_uniqueness_of :creator_id, :scope => :post_id, :on => :create, :unless => :is_deletion, :message => "have already flagged this post"
before_save :update_post
attr_accessor :is_deletion
scope :by_users, -> { where.not(creator: User.system) }
scope :by_system, -> { where(creator: User.system) }

View File

@ -15,7 +15,7 @@
<% if post.is_deleted? %>
<div class="ui-corner-all ui-state-highlight notice notice-deleted">
<% if post.flags.any? %>
<p>This post was deleted for the following reasons: </p>
<p>This post was deleted or flagged for the following reasons: </p>
<%= post_flag_reasons(post) %>
<% else %>
<p>This post was deleted</p>

View File

@ -0,0 +1,5 @@
class AddIsDeletionToPostFlags < ActiveRecord::Migration[5.2]
def change
add_column :post_flags, :is_deletion, :bool, null: false, default: false
end
end

View File

@ -1650,7 +1650,8 @@ CREATE TABLE public.post_flags (
reason text,
is_resolved boolean DEFAULT false NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone
updated_at timestamp without time zone,
is_deletion boolean DEFAULT false NOT NULL
);
@ -5182,6 +5183,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20190623070654'),
('20190714122705'),
('20190717205018'),
('20190718201354');
('20190718201354'),
('20190801210547');