From 5cc45d22d3c5c326917d1a02a09f2afae83d4332 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 12 Mar 2021 05:25:24 +0100 Subject: Remove subscription_expires_at leftover from OStatus (#15857) --- app/models/account.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'app/models') diff --git a/app/models/account.rb b/app/models/account.rb index 6f5bc6295..d85fd1f6e 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -27,7 +27,6 @@ # header_file_size :integer # header_updated_at :datetime # avatar_remote_url :string -# subscription_expires_at :datetime # locked :boolean default(FALSE), not null # header_remote_url :string default(""), not null # last_webfingered_at :datetime @@ -55,6 +54,8 @@ # class Account < ApplicationRecord + self.ignored_columns = %w(subscription_expires_at) + USERNAME_RE = /[a-z0-9_]+([a-z0-9_\.-]+[a-z0-9_]+)?/i MENTION_RE = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]\.\-]+[a-z0-9]+)?)/i @@ -93,7 +94,6 @@ class Account < ApplicationRecord scope :remote, -> { where.not(domain: nil) } scope :local, -> { where(domain: nil) } - scope :expiring, ->(time) { remote.where.not(subscription_expires_at: nil).where('subscription_expires_at < ?', time) } scope :partitioned, -> { order(Arel.sql('row_number() over (partition by domain)')) } scope :silenced, -> { where.not(silenced_at: nil) } scope :suspended, -> { where.not(suspended_at: nil) } @@ -190,10 +190,6 @@ class Account < ApplicationRecord "acct:#{local_username_and_domain}" end - def subscribed? - subscription_expires_at.present? - end - def searchable? !(suspended? || moved?) end -- cgit From 1b02d29be598d71c690bfe04e45e44775384e1dd Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 12 Mar 2021 05:25:50 +0100 Subject: Fix not being able to change world filter expiration back to “Never” (#15858) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #15849 --- app/models/concerns/expireable.rb | 2 +- app/views/filters/_fields.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app/models') diff --git a/app/models/concerns/expireable.rb b/app/models/concerns/expireable.rb index a66a4661b..4d902abcb 100644 --- a/app/models/concerns/expireable.rb +++ b/app/models/concerns/expireable.rb @@ -17,7 +17,7 @@ module Expireable end def expires_in=(interval) - self.expires_at = interval.to_i.seconds.from_now if interval.present? + self.expires_at = interval.present? ? interval.to_i.seconds.from_now : nil @expires_in = interval end diff --git a/app/views/filters/_fields.html.haml b/app/views/filters/_fields.html.haml index fb94a07fc..84dcdcca5 100644 --- a/app/views/filters/_fields.html.haml +++ b/app/views/filters/_fields.html.haml @@ -2,7 +2,7 @@ .fields-row__column.fields-row__column-6.fields-group = f.input :phrase, as: :string, wrapper: :with_label, hint: false .fields-row__column.fields-row__column-6.fields-group - = f.input :expires_in, wrapper: :with_label, collection: [30.minutes, 1.hour, 6.hours, 12.hours, 1.day, 1.week].map(&:to_i), label_method: lambda { |i| I18n.t("invites.expires_in.#{i}") }, prompt: I18n.t('invites.expires_in_prompt') + = f.input :expires_in, wrapper: :with_label, collection: [30.minutes, 1.hour, 6.hours, 12.hours, 1.day, 1.week].map(&:to_i), label_method: lambda { |i| I18n.t("invites.expires_in.#{i}") }, include_blank: I18n.t('invites.expires_in_prompt') .fields-group = f.input :context, wrapper: :with_block_label, collection: CustomFilter::VALID_CONTEXTS, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', label_method: lambda { |context| I18n.t("filters.contexts.#{context}") }, include_blank: false -- cgit