mod reports: include reported user and message in forum post.
Also fix it so that reports against dmails include the key in the dmail link so that mods can view the reported dmail.
This commit is contained in:
@@ -424,7 +424,7 @@ class ApplicationRecord < ActiveRecord::Base
|
||||
end
|
||||
|
||||
concerning :DtextMethods do
|
||||
def dtext_shortlink
|
||||
def dtext_shortlink(**options)
|
||||
"#{self.class.name.underscore.tr("_", " ")} ##{id}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -191,4 +191,8 @@ class Dmail < ApplicationRecord
|
||||
def reportable_by?(user)
|
||||
is_recipient? && !is_automated? && !from.is_moderator?
|
||||
end
|
||||
|
||||
def dtext_shortlink(key: false, **options)
|
||||
key ? "dmail ##{id}/#{key}" : "dmail ##{id}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,15 +39,16 @@ class ModerationReport < ApplicationRecord
|
||||
end
|
||||
|
||||
def forum_post_message
|
||||
messages = ["[b]Submitted by:[/b] @#{creator.name}"]
|
||||
messages << "[b]Submitted against:[/b] #{model.dtext_shortlink}"
|
||||
messages << ""
|
||||
messages << "[quote]"
|
||||
messages << "[b]Reason:[/b]"
|
||||
messages << ""
|
||||
messages << reason
|
||||
messages << "[/quote]"
|
||||
messages.join("\n")
|
||||
<<~EOS
|
||||
[b]Report[/b] modreport ##{id}
|
||||
[b]Submitted by[/b] <@#{creator.name}>
|
||||
[b]Submitted against[/b] #{model.dtext_shortlink(key: true)} by <@#{reported_user.name}>
|
||||
[b]Reason[/b] #{reason}
|
||||
|
||||
[quote]
|
||||
#{model.body}
|
||||
[/quote]
|
||||
EOS
|
||||
end
|
||||
|
||||
def create_forum_post!
|
||||
|
||||
@@ -820,7 +820,7 @@ class User < ApplicationRecord
|
||||
@presenter ||= UserPresenter.new(self)
|
||||
end
|
||||
|
||||
def dtext_shortlink
|
||||
def dtext_shortlink(**options)
|
||||
"<@#{name}>"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user