diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-07-11 21:41:23 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2021-07-11 21:41:23 +0200 |
commit | cdf20f4367226bc5682a0b040fa62f56d6f58fb5 (patch) | |
tree | 630fca746dc138284eb7402c878f212578ebd74c /app/models | |
parent | f040b9aee3f84cb3ba8926fed81d47df3f1094a7 (diff) | |
parent | a2ce7508c95f473a77d46a99fc1e090c0defadcc (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/serializers/rest/instance_serializer.rb`: Upstream changed the fields returned by /api/v1/instance by adding a `configuration` field holding a lot of useful information making our `max_toot_chars` and `poll_limits` fields obsolete. Keeping those around for now for compatibility. - `app/validators/status_length_validator.rb`: No real conflict, just URL_PLACEHOLDER_CHARS introduced too close to MAX_CHARS which is defined differently in glitch-soc. Ported upstream changes.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/report_filter.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/report_filter.rb b/app/models/report_filter.rb index c32d4359e..a91a6baeb 100644 --- a/app/models/report_filter.rb +++ b/app/models/report_filter.rb @@ -6,6 +6,7 @@ class ReportFilter account_id target_account_id by_target_domain + target_origin ).freeze attr_reader :params @@ -34,8 +35,21 @@ class ReportFilter Report.where(account_id: value) when :target_account_id Report.where(target_account_id: value) + when :target_origin + target_origin_scope(value) else raise "Unknown filter: #{key}" end end + + def target_origin_scope(value) + case value.to_sym + when :local + Report.where(target_account: Account.local) + when :remote + Report.where(target_account: Account.remote) + else + raise "Unknown value: #{value}" + end + end end |