mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-21 15:07:47 +01:00
Remove logic to append reasons to existing reports
This commit is contained in:
parent
b6503abdba
commit
5decee81b1
2 changed files with 0 additions and 10 deletions
|
@ -8,12 +8,4 @@ class Report < ApplicationRecord
|
||||||
def target
|
def target
|
||||||
type.sub('Reports::', '').constantize.where(id: target_id).first
|
type.sub('Reports::', '').constantize.where(id: target_id).first
|
||||||
end
|
end
|
||||||
|
|
||||||
def append_reason(new_reason)
|
|
||||||
if reason.nil?
|
|
||||||
update(reason: new_reason)
|
|
||||||
else
|
|
||||||
update(reason: [reason || "", new_reason].join("\n"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -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)
|
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?
|
if existing.nil?
|
||||||
Report.create(type: "Reports::#{object.class}", target_id: object.id, user_id: id, target_user_id: target_user&.id, reason:)
|
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
|
||||||
end
|
end
|
||||||
# endregion
|
# endregion
|
||||||
|
|
Loading…
Reference in a new issue