]> cat aescling's git repositories - mastodon.git/commitdiff
Only normalize local polls (#12515)
authorThibG <thib@sitedethib.com>
Sun, 1 Dec 2019 16:24:33 +0000 (17:24 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 1 Dec 2019 16:24:33 +0000 (17:24 +0100)
Before this patch, if remote poll options have leading or trailing spaces,
the information stored locally won't match them, causing federated voting to
fail.

app/models/poll.rb

index 5427368fd04401cc963be90972ebe4dba62a5a36..b5deafcc21fbe442f54b86fb3a0c7bb592c7aac9 100644 (file)
@@ -36,7 +36,7 @@ class Poll < ApplicationRecord
   scope :attached, -> { where.not(status_id: nil) }
   scope :unattached, -> { where(status_id: nil) }
 
-  before_validation :prepare_options
+  before_validation :prepare_options, if: :local?
   before_validation :prepare_votes_count
 
   after_initialize :prepare_cached_tallies