Merge branch 'hotfix/21.56.9' into master
[gitter.git] / server / serializers / rest / user-id-strategy.js
blobe094567760975480b7dcecaa7729488d617a7d22
1 'use strict';
3 var userService = require('gitter-web-users');
4 var UserStrategy = require('./user-strategy');
6 const mongoReadPrefs = require('gitter-web-persistence-utils/lib/mongo-read-prefs');
7 var idStrategyGenerator = require('gitter-web-serialization/lib/id-strategy-generator');
9 var UserIdStrategy = idStrategyGenerator('UserIdStrategy', UserStrategy, ids => {
10   return userService.findByIds(ids, { read: mongoReadPrefs.secondaryPreferred });
11 });
13 UserIdStrategy.slim = function(options) {
14   var strategy = UserStrategy.slim(options);
15   return UserIdStrategy.withStrategy(strategy);
18 module.exports = UserIdStrategy;