From 5254cfe228e5509412c567595a5ade50d8d2ba9c Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Sat, 3 Oct 2020 12:43:12 -0400 Subject: [PATCH] chore: remove branching --- .../controllers/scopes/scope/authenticate.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ui/core/app/controllers/scopes/scope/authenticate.js b/ui/core/app/controllers/scopes/scope/authenticate.js index 139f77c05..5c36ec58e 100644 --- a/ui/core/app/controllers/scopes/scope/authenticate.js +++ b/ui/core/app/controllers/scopes/scope/authenticate.js @@ -1,19 +1,17 @@ import Controller from '@ember/controller'; -import { sort } from '@ember/object/computed'; export default class ScopesScopeAuthenticateController extends Controller { // =attributes /** + * Moves the global scope to index 0. * @type {Array} */ - @sort('model.scopes', (a, b) => { - if (a.isGlobal) { - return -1; - } else if (b.isGlobal) { - return 1; - } - return 0; - }) - sortedScopes; + get sortedScopes() { + return [ + ...this.model.scopes.filter((scope) => scope.id === 'global'), + ...this.model.scopes.filter((scope) => scope.id !== 'global'), + ] + } + }