Remove logic to append reasons to existing reports

This commit is contained in:
Andreas Nedbal 2025-03-01 20:17:31 +01:00 committed by Andreas Nedbal
parent b6503abdba
commit 5decee81b1
2 changed files with 0 additions and 10 deletions

View file

@ -8,12 +8,4 @@ class Report < ApplicationRecord
def target
type.sub('Reports::', '').constantize.where(id: target_id).first
end
def append_reason(new_reason)
if reason.nil?
update(reason: new_reason)
else
update(reason: [reason || "", new_reason].join("\n"))
end
end
end

View file

@ -159,8 +159,6 @@ class User < ApplicationRecord
existing = Report.find_by(type: "Reports::#{object.class}", target_id: object.id, user_id: id, target_user_id: target_user&.id, resolved: false)
if existing.nil?
Report.create(type: "Reports::#{object.class}", target_id: object.id, user_id: id, target_user_id: target_user&.id, reason:)
elsif !reason.nil? && reason.length.positive?
existing.append_reason(reason)
end
end
# endregion