From c6d893a71dede65dd88a0dfac81178c8e81e27d2 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 22 Sep 2016 21:39:53 +0200 Subject: Uploading/undoing media modifies status text. Also: status text trimmed before validation --- app/models/status.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/models/status.rb') diff --git a/app/models/status.rb b/app/models/status.rb index e336cfe62..ae5c4b496 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -89,4 +89,8 @@ class Status < ApplicationRecord def self.reblogs_map(status_ids, account_id) self.where(reblog_of_id: status_ids).where(account_id: account_id).map { |s| [s.reblog_of_id, true] }.to_h end + + before_validation do + self.text.strip! + end end -- cgit