New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance report overview #8239
base: develop
Are you sure you want to change the base?
Enhance report overview #8239
Conversation
This Feature was requested in this discussion: It is also IMHO a pre-work and touches issue #7847 "handling fake accounts / forward to pod". |
app/helpers/report_helper.rb
Outdated
@@ -8,17 +8,36 @@ module ReportHelper | |||
def report_content(report) | |||
case (item = report.item) | |||
when Post | |||
raw t("report.post_label", content: link_to(post_message(item), post_path(item.id))) | |||
raw t("report.post_label", content: link_to(truncated_post_message(item), post_path(item.id))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails/OutputSafety: Tagging a string as html safe may be a security risk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Flaburgan Here is the old ugly diaspora link-inside-translated text part. I did not care to change anything here
41631c5
to
6bb5180
Compare
6bb5180
to
7c5c7c4
Compare
Hey! This is very needed, thank you for working on this. I'm going to try it and do a review, but two quick remarks:
|
The Images in the first comment are not matching the text.
"Reporter" and "Author" then - I missed this. Do you mean to use the Database' ENUM type? Like the Idea. |
I mean your mockup gave the impression that "No action" was the text stored in the database. This must be avoided, the state (deleted or ignored) has to be stored in the DB, then the UI will display a label depending of the state. |
@Flaburgan Can you make a re-Review? I have abstracted the action - text from database to UI. Wouldn't it be more convenient to open the github "Reviewers" - section? |
I was actually doing it right now 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is GREAT, I love it!
I did some remarks but that's mostly in good shape already. But you would need to also add tests. I started to add them in #8035 but I'm actually not able to navigate to /report in my PR. If you help me fix that PR you should then be able to rebase on me and complete the tests there.
app/controllers/report_controller.rb
Outdated
end | ||
|
||
def update | ||
if report = Report.where(id: params[:id]).first | ||
report.mark_as_reviewed | ||
report.update(action: "No Action") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use the constant there, shouldn't you?
end | ||
|
||
def statistics_by_reporter | ||
sql = "select count(*), diaspora_handle, guid from reports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't that query be written with ActiveRecord?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, But I don't have an idea how. The trick here is: the group by counts all reports, and adds the diaspora_handle from people's table. If this is possible, I think the sql is more straight-forward.
app/controllers/report_controller.rb
Outdated
end | ||
|
||
def statistics_by_author | ||
sql = "select count(*), originator_diaspora_handle, guid from reports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, is there any reason why you use SQL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above, it seems SQL is easier to read (and I don't have a clue how to build this in ActiveRecored) If this can be done, make a proposal without changing the returning data. (haml files rely on that)
app/helpers/notifier_helper.rb
Outdated
end | ||
end | ||
|
||
def truncated_post_message(post) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could have probably be done with an ellipsis in CSS, but I'm also fine with that code, especially because it checks the title
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, more than the title is displayed in the admin screen so not sure what this is about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old diaspora code has the link.tag as a translated text, which adds the un-markdoned directly inside the link-tag. So here can't be simply css cuts the text, it must be done in the plan-text part.
app/models/report.rb
Outdated
|
||
belongs_to :user | ||
belongs_to :post, optional: true | ||
belongs_to :comment, optional: true | ||
belongs_to :item, polymorphic: true | ||
|
||
after_commit :send_report_notification, :on => :create | ||
STATUS_DELETED = "deleted" | ||
STATUS_NO_ACTION = "no action" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say I prefer "ignored" than "no action", but this is a matter of taste probably. @goobertron opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd need to know the context into which this text fits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have it in the column "Action" of the first screenshot in #8239 (comment)
But to me it's also about the internal naming. But that's not that important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'no action' seems fine to me in that context. It makes clear that a decision has been made to take no action on that content. The label 'ignored' is potentially confusing: it could mean that the person who looked at the report decided to ignore the report (didn't make a decision), or that the content was 'ignored' i.e. hidden, or something else.
I'm not sure why some of the reports that have 'no action' next to them also have eye and bin icons to the right of them and others don't – is that clear to anyone using this feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Fla found out, with introduction of the new "action" field, no existing Reports have a default initial value. I've added a migration and set all existing Reports to 'NO_ACTION', so every reviewed report should now have the action buttons.
|
||
class AddActionToReport < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :reports, :action, :string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to add a migration for the previously reports to be set to "No action"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't true, as not all reports were done with "no action", some might also have been deleted. So you could either decide if a post was deleted by checking if the post still exists (but that would also be guessing, as it could also be the author of the post who self deleted the post), or just keep it as NULL
and then show it as "Unknown" in the frontend if there is no action
, as we don't know what happened.
Edit: Ok, I just saw that you then mark them as deleted if they reported item doesn't exist anymore in the second migration. As said, I would combine those migrations to one (so not everything needs to be touched twice), and I still want to keep my original comment here, as marking them as deleted if it doesn't exist anymore still is kind of guessing, it doesn't mean it was deleted as part of the report, so I think just keeping them NULL
, as that reflects the truth, and we don't know what happened.
What you could do as middle way is, that you mark them as "no action" if it still exists (because that one we know), and as NULL
(and show "Unknown" in the UI) if it doesn't exist anymore, because that one we don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have merged the two migrations together and adjusted the behavior according to your suggestion.
app/views/report/_pending.haml
Outdated
= report.text | ||
.panel-body | ||
.content | ||
= report_content(report) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you are modifying this code, could you please also add the author of the reported post?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in line 12 report.author.name is a delegate to report.item.author, aka the author of the reported post.
8706cc2
to
0adc2aa
Compare
find("tr", text: "Deleted") | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingEmptyLines: 1 trailing blank lines detected.
@Flaburgan I rebased this on Enhance Report Form |
With undecided / reviewed and statistics page. Already reviewed reports stay visible. Enhances Spam/user control fixes diaspora#8239
f2f5232
to
307053f
Compare
@Flaburgan , @SuperTux88 |
#8035 is adding tests on that part of the code so we said we should merge it first, but it's blocked by some weird Jasmine flickering tests. If you want to help there you're welcome! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is depending on #8035, this isn't a full review yet (I maybe have missed some things between all the changes of the other PR), and you might also want to wait until #8035 is done before working on some of my comments (as there will be conflicts). But there is also already some feedback you can work on without having conflicts, so I already wanted to submit that before the other PR is done.
Also, I couldn't add a comment to that file, as it doesn't have a single line, but you accidentally deleted tmp/pids/.gitkeep
.
@@ -0,0 +1,19 @@ | |||
# frozen_string_literal: true | |||
|
|||
class AddUserFieldsToReports < ActiveRecord::Migration[5.2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can combine the two migrations into one adding both columns at the same time.
|
||
class AddUserFieldsToReports < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :reports, :originator_diaspora_handle, :string, index: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, please don't use the term "diaspora handle" anymore, it's called "diaspora* ID" now. There are still some really old columns that are called diaspora_handle
but that's just because nobody renamed them yet.
Second, instead of storing the diaspora ID, you should just store the person ID.
I'm also not sure about "originator", I think reported_person_id
or reported_author_id
is clearer, that it's about the reported content not about the reporter (the originator of the report).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With ID you mean the numeric id column or the unique guid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with "person ID" I mean the numeric id
column of the people
table.
app/models/report.rb
Outdated
|
||
after_commit :send_report_notification, :on => :create | ||
STATUS_DELETED = "deleted" | ||
STATUS_NO_ACTION = "no action" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would define this as "no_action"
(with underscore), so it can be directly used in translations keys without the need of asking for action_no_action?
.
app/models/report.rb
Outdated
def action_deleted? | ||
action&.downcase == STATUS_DELETED.downcase | ||
end | ||
|
||
def action_no_action? | ||
action&.downcase == STATUS_NO_ACTION.downcase | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these are needed, if you define the status variables with underscores, they can be directly used in translation keys and you don't need this extra step of asking this method. And for the tests where you used this method, you can just check if action
equals the key it should.
Also I don't think this would need a downcase
. This can basically only be something else than the status defined in the code if somebody manipulated the database manually, which isn't supported (if people do that, it's on their own risk, things will break, and if they not only change the casing but also add a typo, it wouldn't work anymore anyway).
app/models/report.rb
Outdated
def mark_as_reviewed_and_deleted | ||
Report.where(item_id: item_id, item_type: item_type) | ||
.update_all(reviewed: true, action: STATUS_DELETED) | ||
end | ||
|
||
def mark_as_reviewed | ||
Report.where(item_id: item_id, item_type: item_type).update_all(reviewed: true) | ||
Report.where(item_id: item_id, item_type: item_type) | ||
.update_all(reviewed: true, action: STATUS_NO_ACTION) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just create one method mark_as_reviewed
(as before) with the action
as parameter. Having them both, but one with _and_deleted
is a bit confusing (and also basically code duplication as the action
is the only difference).
app/helpers/notifier_helper.rb
Outdated
def truncated_post_message(post) | ||
if post.respond_to? :message | ||
plain_text = post.message.try(:plain_text_without_markdown).presence || post_page_title(post) | ||
truncate(plain_text, length: 300) | ||
else | ||
I18n.t "notifier.a_post_you_shared" | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has nothing to do with the notifier, so it shouldn't be added here.
Also, as commented in #8035 (comment), I would just use post_page_title(post)
in all cases (which already is truncated), so this isn't even needed at all (also I think this should already be fixed in #8035, so you wouldn't need to do anything).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as suggested
app/helpers/notifier_helper.rb
Outdated
def truncated_comment_message(comment) | ||
if comment.post.public? | ||
plain_text = comment.message.plain_text_without_markdown | ||
truncate(plain_text, length: 180) | ||
else | ||
I18n.t "notifier.a_limited_post_comment" | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, this isn't needed, and #8035 should already use comment.message.title
directly, so you don't need to do anything here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as suggested
app/models/report.rb
Outdated
|
||
belongs_to :user | ||
belongs_to :post, optional: true | ||
belongs_to :comment, optional: true | ||
belongs_to :item, polymorphic: true | ||
delegate :author, to: :item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the author of the item as author
here is very confusing, as report.author
then looks like this is the author if the report, please add at least a prefix: true
here.
Also, as the item might get deleted, it would probably be smarter to instead use the new column which stores the author of the reported item even if the item itself gets deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, if the item is deleted the author is also not every interesting. I'll take the prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm 2: There exists already a 'reported_author' in the report model. This is already a better name for what it means. I drop the delegate and use the existing code.
app/views/report/_pending.haml
Outdated
.reporter.pull-right | ||
!= t("report.reported_label", person: link_to(username, user_profile_path(username))) | ||
.author | ||
%span.reason-label | ||
!= "#{t('report.author')}:" | ||
%span | ||
= report.author.name | ||
.created-at | ||
%span.reason-label | ||
!= "#{t('report.created_at')}:" | ||
%span | ||
= I18n.l(report.created_at, format: :short) | ||
.reason | ||
%span.reason-label | ||
= t("report.reason_label") | ||
%span | ||
= report.text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be very confusing, what is about what. We have "Created at" which is about the report, and then we have "Author" which is the author of the reported item. I don't really know what's the best solution for this, maybe changing the text to "Reported Author/Person" makes it clearer, or maybe having two columns, one for the stuff that is about the report, and one that is about the reported item? But really, I'm mostly throwing ideas here and don't know what is best.
Also, as this information here is also interesting even if the item was deleted (for example by the author of the reported item), I would restructure the code there to always show the same things. The only difference is that if the item was deleted you can't show the text/link of the reported item anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
report.author
is now prefixed with item_author. I also changed the localized text. But you are right, we have the report author, message and creation date as well as the items (post, comments) attributes of the same meaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I now see, there is already a reported_author
in the model. I use this.
app/views/report/_checked.haml
Outdated
- unless report.originator_diaspora_handle.nil? | ||
= link_to(report.originator_diaspora_handle, "/people/#{report.originator_guid}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't know the author of the reported item anymore (because it was deleted before the migration), then I would show "Unknown" here instead of just blank.
With undecided / reviewed and statistics page Already reviewed reports stay visible Enhances Spam/user control fixes diaspora#8239
de58572
to
a0c1d84
Compare
app/assets/javascripts/app/app.js
Outdated
$("#reportModal").modal("hide"); | ||
let textarea = document.getElementById("report-reason-field"); | ||
let report = { | ||
item_id: form.dataset.reportId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identifier 'item_id' is not in camel case.
app/assets/javascripts/app/app.js
Outdated
let textarea = document.getElementById("report-reason-field"); | ||
let report = { | ||
item_id: form.dataset.reportId, | ||
item_type: form.dataset.reportType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identifier 'item_type' is not in camel case.
|
||
def reported_author | ||
item.author if item | ||
return Person.find(reported_author_id) if reported_author_id.present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
app/models/report.rb
Outdated
return unless Report.where(item_id: item_id, item_type: item_type).exists?(user_id: user_id) | ||
|
||
errors.add(:base, "You cannot report the same post twice.") | ||
if Report.where(item_id: item_id, item_type: item_type).exists?(user_id: user_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/GuardClause: Use a guard clause (return unless Report.where(item_id: item_id, item_type: item_type).exists?(user_id: user_id)
) instead of wrapping the code inside a conditional expression.
app/models/report.rb
Outdated
return unless Post.find_by(id: item_id).nil? && Comment.find_by(id: item_id).nil? | ||
|
||
errors.add(:base, "Post or comment was already deleted or doesn't exists.") | ||
if Post.find_by(id: item_id).nil? && Comment.find_by(id: item_id).nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/GuardClause: Use a guard clause (return unless Post.find_by(id: item_id).nil? && Comment.find_by(id: item_id).nil?
) instead of wrapping the code inside a conditional expression.
@@ -0,0 +1,20 @@ | |||
class AddActionFieldsToReports < ActiveRecord::Migration[6.1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/FrozenStringLiteralComment: Missing frozen string literal comment.
@@ -0,0 +1,20 @@ | |||
class AddActionFieldsToReports < ActiveRecord::Migration[6.1] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning.
|
||
Report.find_each do |report| | ||
# get reported author id from item before item gets deleted | ||
if report.reported_author.present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/IfUnlessModifier: Favor modifier if
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
.
if report.reported_author.present? | ||
report.reported_author_id = report.reported_author.id | ||
end | ||
if report.item.present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/IfUnlessModifier: Favor modifier if
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
.
a0c1d84
to
96153c0
Compare
@@ -0,0 +1,16 @@ | |||
# frozen_string_literal: true | |||
class AddActionFieldsToReports < ActiveRecord::Migration[6.1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/EmptyLineAfterMagicComment: Add an empty line after magic comments.
@Flaburgan I rebased this to your #8035 and fixed most of my issues here. |
With undecided / reviewed and statistics page Already reviewed reports stay visible Enhances Spam/user control fixes diaspora#8239
96153c0
to
98d5180
Compare
= t("report.decision") | ||
%th | ||
= t("report.action") | ||
- @reviewed_reports.each do |report| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using instance variables in partials views
@@ -0,0 +1,43 @@ | |||
- @unreviewed_reports.each do |report| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using instance variables in partials views
data: {confirm: t("report.confirm_deletion")}, | ||
class: "btn pull-right btn-danger btn-small col-md-3 col-xs-12", | ||
method: :delete | ||
- if @unreviewed_reports.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using instance variables in partials views
@@ -0,0 +1,43 @@ | |||
- @unreviewed_reports.each do |report| | |||
.panel.panel-default | |||
- reported_by = report.user.username |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UselessAssignment: Useless assignment to variable - reported_by
. Did you mean report
?
!= t("report.reported_label", person: link_to(reported_by, user_profile_path(reported_by))) | ||
.author | ||
%span.reason-label | ||
!= "#{t('report.reported_author')}:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
= t("report.count") | ||
%th | ||
= t("report.reported_author") | ||
- @statistics_by_author.rows.each do |count, author_diaspora_handle, guid| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using instance variables in partials views
@@ -4,33 +4,44 @@ class Report < ApplicationRecord | |||
validates :user_id, presence: true | |||
validates :item_id, presence: true | |||
validates :item_type, presence: true, inclusion: { | |||
in: %w(Post Comment), message: "Type should match `Post` or `Comment`!"} | |||
in: %w[Post Comment], message: "Type should match `Post` or `Comment`!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails/I18nLocaleTexts: Move locale texts to the locale files in the config/locales
directory.
end | ||
|
||
def entry_does_not_exist | ||
return unless Report.where(item_id: item_id, item_type: item_type).exists?(user_id: user_id) | ||
|
||
errors.add(:base, "You cannot report the same post twice.") | ||
errors[:base] << "You cannot report the same post twice." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails/DeprecatedActiveModelErrorsMethods: Avoid manipulating ActiveModel errors as hash directly.
end | ||
|
||
def post_or_comment_does_exist | ||
return unless Post.find_by(id: item_id).nil? && Comment.find_by(id: item_id).nil? | ||
|
||
errors.add(:base, "Post or comment was already deleted or doesn't exists.") | ||
errors[:base] << "Post or comment was already deleted or doesn't exists." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails/DeprecatedActiveModelErrorsMethods: Avoid manipulating ActiveModel errors as hash directly.
@@ -50,12 +61,16 @@ def destroy_reported_item | |||
item.destroy | |||
end | |||
end | |||
mark_as_reviewed | |||
mark_as_reviewed(STATUS_DELETED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/AbcSize: Assignment Branch Condition size for destroy_reported_item is too high. [<0, 32, 7> 32.76/20]
So because the report modal got merged, I rebased this MR, squashed the commits and fixed the front-end pronto problems. There are still a lot of them but I'd like help to resolve those. |
With undecided / reviewed and statistics page Already reviewed reports stay visible Enhances Spam/user control fixes diaspora#8239
98d5180
to
9d89f2a
Compare
@SuperTux88 about the remark you made about the design now that multi lines reports are possible. It looks fine (the design isn't broken) but we are losing the line break: Is there anything else you want me to check on the front-end side? |
This PR enhances the admin/moderators report overview by
Heads up!
It needs a migration!
Two fields are added: a 'action' textfield that is used to describe what happened to the report. Its free text, but filled based on the action.
The second fields holds the diaspora_handel for the originator. This is needed because after deleting a report this information is gone.
What is the outcome?
A Podmin now has more insights in old reports and in most reporter and most originators. A valuable base for more decisions what to do.
Future
List of reports grows without limits - a paginated view would be nice, but that was currently above my skill level.
Screenshots
(Added date time)
( deleted or reviewed reports)
(statistics with links to the authors / originators)
Comments, Ideas, critics... welcome!