chore: 🤖 add support for exclusively org-scoped resources

This commit is contained in:
Randall Morey committed 2020-05-18 12:29:33 -04:00
1 parent c7865c073e
commit d5c00c2863
2 files changed
+30 -1

No files matched your search

+15 -1
View File
@@ -7,8 +7,22 @@ import { inject as service } from '@ember/service';
* reported by `ScopeService`.
*/
export default Mixin.create({
// =services
scope: service(),
// =properties
/**
* If true and the current scope has a project, will include the project in
* the resource path. Set to false for resources that are scoped exclusively
* to org.
* @type {boolean}
*/
includeProject: true,
// =methods
/**
* Appends a scope path to the URL prefix, if a scope is set.
* @override
@@ -33,7 +47,7 @@ export default Mixin.create({
const { org, project } = this.scope;
const scopePath = [];
if (org) scopePath.push('orgs', org.id);
if (project) scopePath.push('projects', project.id);
if (project && this.includeProject) scopePath.push('projects', project.id);
return scopePath.join('/');
},
});