3 var restSerializer = require('../../../serializers/rest-serializer');
4 var util = require('util');
5 var groupRoomSuggestions = require('gitter-web-groups/lib/group-room-suggestions');
6 var groupService = require('gitter-web-groups/lib/group-service');
8 /* TODO: replace this */
10 index: util.deprecate(function(req) {
11 if (!req.user) return [];
12 var userId = req.user._id;
15 .findByUri(req.params.orgName, { lean: true })
16 .then(function(group) {
17 if (!group) return [];
19 return groupRoomSuggestions.findUnjoinedRoomsInGroup(group._id, userId);
21 .then(function(suggestions) {
22 var strategy = restSerializer.TroupeStrategy.createSuggestionStrategy();
23 return restSerializer.serialize(suggestions, strategy);
25 }, '/v1/orgs/:orgName/suggestedRooms is deprecated')