Skip to content

Commit

Permalink
Remove uses of getWithDefault
Browse files Browse the repository at this point in the history
Thanks to @johncowen for pointing out that this is on the
way to being deprecated: #5944 (comment)

emberjs/rfcs#554
  • Loading branch information
backspace committed Dec 5, 2019
1 parent c50c55c commit 94304e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ui/app/abilities/job.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Ability } from 'ember-can';
import { inject as service } from '@ember/service';
import { computed, getWithDefault } from '@ember/object';
import { computed, get } from '@ember/object';
import { equal, or } from '@ember/object/computed';

export default Ability.extend({
Expand All @@ -19,7 +19,7 @@ export default Ability.extend({
let activeNamespace = this.activeNamespace;

return (this.get('token.selfTokenPolicies') || []).toArray().reduce((rules, policy) => {
let policyNamespaces = getWithDefault(policy, 'rulesJSON.Namespaces', []);
let policyNamespaces = get(policy, 'rulesJSON.Namespaces') || [];

let matchingNamespace = this._findMatchingNamespace(policyNamespaces, activeNamespace);

Expand All @@ -33,7 +33,7 @@ export default Ability.extend({

policiesSupportRunning: computed('rulesForActiveNamespace.@each.capabilities', function() {
return this.rulesForActiveNamespace.some(rules => {
let capabilities = getWithDefault(rules, 'Capabilities', []);
let capabilities = get(rules, 'Capabilities') || [];
return capabilities.includes('submit-job');
});
}),
Expand Down

0 comments on commit 94304e6

Please sign in to comment.