diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-03-02 19:11:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-02 19:11:17 +0100 |
commit | d9e30efa5ecc87bc9be7b2e28baaf34bd01032f5 (patch) | |
tree | a2bb52cd8418feb062b908dfaf98d00a3c0ccbbe /app/helpers | |
parent | 0b8fe020b599341d78cc03431eb156485c70ebea (diff) | |
parent | 78781793d5ab370829d7eaee4b8d21994f84763c (diff) |
Merge pull request #1709 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8b41033a5..818253e86 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -225,4 +225,19 @@ module ApplicationHelper content_tag(:script, json_escape(json).html_safe, id: 'initial-state', type: 'application/json') # rubocop:enable Rails/OutputSafety end + + def grouped_scopes(scopes) + scope_parser = ScopeParser.new + scope_transformer = ScopeTransformer.new + + scopes.each_with_object({}) do |str, h| + scope = scope_transformer.apply(scope_parser.parse(str)) + + if h[scope.key] + h[scope.key].merge!(scope) + else + h[scope.key] = scope + end + end.values + end end |