From 43a40ff1cbd89e9af315a4f388f9787c0c993f93 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 10 Feb 2022 00:15:30 +0100 Subject: [PATCH] Add editing for published statuses (#17320) * Add editing for published statuses * Fix change of multiple-choice boolean in poll not resetting votes * Remove the ability to update existing media attachments for now --- app/models/status.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/status.rb b/app/models/status.rb index 1b2adae4d369c7..7b7c25afd122dc 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -224,6 +224,16 @@ def distributable? public_visibility? || unlisted_visibility? end + def snapshot!(media_attachments_changed: false, account_id: nil, at_time: nil) + edits.create!( + text: text, + spoiler_text: spoiler_text, + media_attachments_changed: media_attachments_changed, + account_id: account_id || self.account_id, + created_at: at_time || edited_at + ) + end + def edited? edited_at.present? end