mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-12 23:43:23 +00:00
Compare commits
2 Commits
86ff756ebb
...
5365234bc3
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5365234bc3 | ||
![]() |
c200cb5e09 |
|
@ -50,7 +50,7 @@ class SessionActivation < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def purge_old
|
def purge_old
|
||||||
latest.offset(Rails.configuration.x.max_session_activations).destroy_all
|
latest.offset(Rails.configuration.x.mastodon.max_session_activations).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
def exclusive(id)
|
def exclusive(id)
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Rails.application.configure do
|
|
||||||
config.x.max_session_activations = ENV['MAX_SESSION_ACTIVATIONS'] || 10
|
|
||||||
end
|
|
|
@ -2,6 +2,7 @@
|
||||||
shared:
|
shared:
|
||||||
experimental_features: <%= ENV.fetch('EXPERIMENTAL_FEATURES', nil) %>
|
experimental_features: <%= ENV.fetch('EXPERIMENTAL_FEATURES', nil) %>
|
||||||
limited_federation_mode: <%= (ENV.fetch('LIMITED_FEDERATION_MODE', nil) || ENV.fetch('WHITELIST_MODE', nil)) == 'true' %>
|
limited_federation_mode: <%= (ENV.fetch('LIMITED_FEDERATION_MODE', nil) || ENV.fetch('WHITELIST_MODE', nil)) == 'true' %>
|
||||||
|
max_session_activations: <%= ENV.fetch('MAX_SESSION_ACTIVATIONS', 10) %>
|
||||||
self_destruct_value: <%= ENV.fetch('SELF_DESTRUCT', nil)&.to_json %>
|
self_destruct_value: <%= ENV.fetch('SELF_DESTRUCT', nil)&.to_json %>
|
||||||
software_update_url: <%= ENV.fetch('UPDATE_CHECK_URL', 'https://api.joinmastodon.org/update-check')&.to_json %>
|
software_update_url: <%= ENV.fetch('UPDATE_CHECK_URL', 'https://api.joinmastodon.org/update-check')&.to_json %>
|
||||||
source:
|
source:
|
||||||
|
|
|
@ -78,10 +78,10 @@ RSpec.describe SessionActivation do
|
||||||
|
|
||||||
describe '.purge_old' do
|
describe '.purge_old' do
|
||||||
around do |example|
|
around do |example|
|
||||||
before = Rails.configuration.x.max_session_activations
|
before = Rails.configuration.x.mastodon.max_session_activations
|
||||||
Rails.configuration.x.max_session_activations = 1
|
Rails.configuration.x.mastodon.max_session_activations = 1
|
||||||
example.run
|
example.run
|
||||||
Rails.configuration.x.max_session_activations = before
|
Rails.configuration.x.mastodon.max_session_activations = before
|
||||||
end
|
end
|
||||||
|
|
||||||
let!(:oldest_session_activation) { Fabricate(:session_activation, created_at: 10.days.ago) }
|
let!(:oldest_session_activation) { Fabricate(:session_activation, created_at: 10.days.ago) }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user