about summary refs log tree commit diff
path: root/app/lib/activitypub/parser/media_attachment_parser.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-03-26 00:38:44 +0100
committerGitHub <noreply@github.com>2022-03-26 00:38:44 +0100
commit71f2b95106b2e75d3efb40040b29c216c2d99ee6 (patch)
tree4a84b1bc4238cacde0eb05acbfce81b682643ddb /app/lib/activitypub/parser/media_attachment_parser.rb
parente3a220306181f9aeda41940bfb11e4350d113e77 (diff)
Fix edits with no actual changes being allowed (#17843)
* Fix edits with no actual changes being allowed locally

* Fix edits with no actual changes being allowed through ActivityPub

* Fix false positive changes caused by description processing in model

* Fix not recording poll expiration update

* Fix test

* Revert changes to ProcessStatusUpdateService

* Various fixes and improvements

* Fix code style issues

* Various changes and improvements

* Add guard clause
Diffstat (limited to 'app/lib/activitypub/parser/media_attachment_parser.rb')
-rw-r--r--app/lib/activitypub/parser/media_attachment_parser.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/lib/activitypub/parser/media_attachment_parser.rb b/app/lib/activitypub/parser/media_attachment_parser.rb
index 1798e58a4..30bea1f0e 100644
--- a/app/lib/activitypub/parser/media_attachment_parser.rb
+++ b/app/lib/activitypub/parser/media_attachment_parser.rb
@@ -27,7 +27,9 @@ class ActivityPub::Parser::MediaAttachmentParser
   end
 
   def description
-    @json['summary'].presence || @json['name'].presence
+    str = @json['summary'].presence || @json['name'].presence
+    str = str.strip[0...MediaAttachment::MAX_DESCRIPTION_LENGTH] if str.present?
+    str
   end
 
   def focus