Merge branch 'hotfix/21.56.9' into master
[gitter.git] / server / api / private / invite-user-suggestions.js
blob26879ff2b81045d64225407ccd81f4b05960813b
1 'use strict';
3 var debug = require('debug')('gitter:api:invite-user-suggestions');
4 var collaboratorsService = require('gitter-web-collaborators');
6 function resolveInviteUserSuggestions(req, res, next) {
7   // null, 'GH_REPO', 'GH_ORG'
8   var type = req.query.type;
9   var linkPath = req.query.linkPath;
11   return collaboratorsService
12     .findCollaborators(req.user, type, linkPath)
13     .then(function(suggestions) {
14       debug('suggestions', suggestions);
15       res.send(suggestions);
16     })
17     .catch(function(err) {
18       debug('err', err, err.stack);
19       throw err;
20     })
21     .catch(next);
24 module.exports = resolveInviteUserSuggestions;