Skip to content

Commit

Permalink
Fix group searching by using the full path
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskbx committed Oct 10, 2017
1 parent 3b8a381 commit 06de05b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/models/owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ class owner extends Base {
*/
getGroup() {
return new Promise((resolve, reject) => {
this.get(`groups/?search=${encodeURIComponent(this.config.get('project'))}`)
.then(group => {
if (group.body.length === 0) return reject('Group not found');
let filtered = group.body.filter(u => u.path === this.config.get('project'));
if (filtered.length === 0) return reject();
this.get(`groups`)
.then(groups => {
if (groups.body.length === 0) return reject('Group not found');
groups = groups.body;

let filtered = groups.filter(group => group.full_path === this.config.get('project'));
if (filtered.length === 0) return reject('Group not found');
this.groups = this.groups.concat(filtered);
resolve();
})
Expand Down

0 comments on commit 06de05b

Please sign in to comment.