|
@@ -108,14 +108,15 @@ const addSlashOfEnd = (path) => {
|
|
|
* @param {string} userPublicFields string to set to select
|
|
* @param {string} userPublicFields string to set to select
|
|
|
*/
|
|
*/
|
|
|
/* eslint-disable object-curly-newline, object-property-newline */
|
|
/* eslint-disable object-curly-newline, object-property-newline */
|
|
|
-const populateDataToShowRevision = (page, userPublicFields, imagePopulation) => {
|
|
|
|
|
|
|
+const populateDataToShowRevision = (page, userPublicFields) => {
|
|
|
|
|
+ // [TODO][user-profile-cache] change how to get profile image data in client side.
|
|
|
return page
|
|
return page
|
|
|
.populate([
|
|
.populate([
|
|
|
- { path: 'lastUpdateUser', model: 'User', select: userPublicFields, populate: imagePopulation },
|
|
|
|
|
- { path: 'creator', model: 'User', select: userPublicFields, populate: imagePopulation },
|
|
|
|
|
|
|
+ { path: 'lastUpdateUser', model: 'User', select: userPublicFields },
|
|
|
|
|
+ { path: 'creator', model: 'User', select: userPublicFields },
|
|
|
{ path: 'grantedGroup', model: 'UserGroup' },
|
|
{ path: 'grantedGroup', model: 'UserGroup' },
|
|
|
{ path: 'revision', model: 'Revision', populate: {
|
|
{ path: 'revision', model: 'Revision', populate: {
|
|
|
- path: 'author', model: 'User', select: userPublicFields, populate: imagePopulation,
|
|
|
|
|
|
|
+ path: 'author', model: 'User', select: userPublicFields,
|
|
|
} },
|
|
} },
|
|
|
]);
|
|
]);
|
|
|
};
|
|
};
|
|
@@ -263,12 +264,12 @@ class PageQueryBuilder {
|
|
|
return this;
|
|
return this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- populateDataToList(userPublicFields, imagePopulation) {
|
|
|
|
|
|
|
+ populateDataToList(userPublicFields) {
|
|
|
|
|
+ // [TODO][user-profile-cache] change how to get profile image data in client side.
|
|
|
this.query = this.query
|
|
this.query = this.query
|
|
|
.populate({
|
|
.populate({
|
|
|
path: 'lastUpdateUser',
|
|
path: 'lastUpdateUser',
|
|
|
select: userPublicFields,
|
|
select: userPublicFields,
|
|
|
- populate: imagePopulation,
|
|
|
|
|
});
|
|
});
|
|
|
return this;
|
|
return this;
|
|
|
}
|
|
}
|
|
@@ -460,8 +461,9 @@ module.exports = function(crowi) {
|
|
|
pageSchema.methods.populateDataToShowRevision = async function() {
|
|
pageSchema.methods.populateDataToShowRevision = async function() {
|
|
|
validateCrowi();
|
|
validateCrowi();
|
|
|
|
|
|
|
|
|
|
+ // [TODO][user-profile-cache] change how to get profile image data in client side.
|
|
|
const User = crowi.model('User');
|
|
const User = crowi.model('User');
|
|
|
- return populateDataToShowRevision(this, User.USER_PUBLIC_FIELDS, User.IMAGE_POPULATION)
|
|
|
|
|
|
|
+ return populateDataToShowRevision(this, User.USER_PUBLIC_FIELDS)
|
|
|
.execPopulate();
|
|
.execPopulate();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -754,7 +756,8 @@ module.exports = function(crowi) {
|
|
|
const totalCount = await builder.query.exec('count');
|
|
const totalCount = await builder.query.exec('count');
|
|
|
|
|
|
|
|
// find
|
|
// find
|
|
|
- builder.populateDataToList(User.USER_PUBLIC_FIELDS, User.IMAGE_POPULATION);
|
|
|
|
|
|
|
+ // [TODO][user-profile-cache] change how to get profile image data in client side.
|
|
|
|
|
+ builder.populateDataToList(User.USER_PUBLIC_FIELDS);
|
|
|
const pages = await builder.query.exec('find');
|
|
const pages = await builder.query.exec('find');
|
|
|
|
|
|
|
|
const result = {
|
|
const result = {
|
|
@@ -795,9 +798,10 @@ module.exports = function(crowi) {
|
|
|
// count
|
|
// count
|
|
|
const totalCount = await builder.query.exec('count');
|
|
const totalCount = await builder.query.exec('count');
|
|
|
|
|
|
|
|
|
|
+ // [TODO][user-profile-cache] change how to get profile image data in client side.
|
|
|
// find
|
|
// find
|
|
|
builder.addConditionToPagenate(opt.offset, opt.limit, sortOpt);
|
|
builder.addConditionToPagenate(opt.offset, opt.limit, sortOpt);
|
|
|
- builder.populateDataToList(User.USER_PUBLIC_FIELDS, User.IMAGE_POPULATION);
|
|
|
|
|
|
|
+ builder.populateDataToList(User.USER_PUBLIC_FIELDS);
|
|
|
const pages = await builder.query.exec('find');
|
|
const pages = await builder.query.exec('find');
|
|
|
|
|
|
|
|
const result = {
|
|
const result = {
|