diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2023-09-04 09:09:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-04 09:09:25 +0200 |
commit | e52d0494ee453cf023365eeed99e1c8dca34916f (patch) | |
tree | 3023e22869a18d7c47e1a0704e36f39bdcc2dd8f | |
parent | 173041f02cb6aba9f62310eb1451852dae97b0ff (diff) |
Fix `before:`, `after:` and `during:` failing when time zone not set (#26782)
-rw-r--r-- | app/lib/search_query_transformer.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/lib/search_query_transformer.rb b/app/lib/search_query_transformer.rb index e81c0c081e3..2c8e95afeeb 100644 --- a/app/lib/search_query_transformer.rb +++ b/app/lib/search_query_transformer.rb @@ -95,15 +95,15 @@ class SearchQueryTransformer < Parslet::Transform when 'before' @filter = :created_at @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' @filter = :created_at @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' @filter = :created_at @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 raise "Unknown prefix: #{prefix}" end |