Merge branch 'hotfix/21.56.9' into master
[gitter.git] / public / js / collections / user-search.js
blobabe38f889b89f6e7d76317874839438859a25727
1 'use strict';
3 var Backbone = require('backbone');
4 var SyncMixin = require('./sync-mixin');
6 var UserSearchModel = Backbone.Model.extend({
7 idAttribute: 'id'
8 });
10 var UserSearchCollection = Backbone.Collection.extend({
11 url: '/v1/user',
12 model: UserSearchModel,
13 parse: function(response) {
14 //If we don't get any results make sure we return an empty array
15 //this stops erroneous blank results being shown in typeaheads
16 //jp 5/11/15
17 return [].concat(response.results || []);
19 sync: SyncMixin.sync
20 });
22 module.exports = {
23 Model: UserSearchModel,
24 Collection: UserSearchCollection