1
0
mirror of https://github.com/mastodon/mastodon synced 2024-12-01 00:08:21 +09:00

Fix before:, after: and during: failing when time zone not set (#26782)

This commit is contained in:
Eugen Rochko 2023-09-04 09:09:25 +02:00 committed by GitHub
parent 173041f02c
commit e52d0494ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,15 +95,15 @@ class SearchQueryTransformer < Parslet::Transform
when 'before' when 'before'
@filter = :created_at @filter = :created_at
@type = :range @type = :range
@term = { lt: term, time_zone: @options[:current_account]&.user_time_zone || 'UTC' } @term = { lt: term, time_zone: @options[:current_account]&.user_time_zone.presence || 'UTC' }
when 'after' when 'after'
@filter = :created_at @filter = :created_at
@type = :range @type = :range
@term = { gt: term, time_zone: @options[:current_account]&.user_time_zone || 'UTC' } @term = { gt: term, time_zone: @options[:current_account]&.user_time_zone.presence || 'UTC' }
when 'during' when 'during'
@filter = :created_at @filter = :created_at
@type = :range @type = :range
@term = { gte: term, lte: term, time_zone: @options[:current_account]&.user_time_zone || 'UTC' } @term = { gte: term, lte: term, time_zone: @options[:current_account]&.user_time_zone.presence || 'UTC' }
else else
raise "Unknown prefix: #{prefix}" raise "Unknown prefix: #{prefix}"
end end