From 880a5eb25cc62d2181b34a21985addee847cbb49 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 13 Jul 2017 03:12:25 +0200 Subject: Fix boolean columns sometimes having a null value (#4162) * Fix boolean columns sometimes having a null value * Fix wrong value being set instead of null --- app/models/status.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/models/status.rb') diff --git a/app/models/status.rb b/app/models/status.rb index edf805336..65db7579a 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -12,12 +12,12 @@ # in_reply_to_id :integer # reblog_of_id :integer # url :string -# sensitive :boolean default(FALSE) +# sensitive :boolean default(FALSE), not null # visibility :integer default("public"), not null # in_reply_to_account_id :integer # application_id :integer # spoiler_text :text default(""), not null -# reply :boolean default(FALSE) +# reply :boolean default(FALSE), not null # favourites_count :integer default(0), not null # reblogs_count :integer default(0), not null # language :string @@ -249,6 +249,7 @@ class Status < ApplicationRecord def set_visibility self.visibility = (account.locked? ? :private : :public) if visibility.nil? + self.sensitive = false if sensitive.nil? end def set_sensitivity -- cgit