no message
This commit is contained in:
@@ -169,15 +169,24 @@ module.exports = {
|
||||
allMessageImages: (e, profileId) => {
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
ProfileModel
|
||||
.find({ _id: profileId, 'messages.$.image': { $exists: true } })
|
||||
.select('messages')
|
||||
.exec((err, result) => {
|
||||
.findById(profileId, (err, profile) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
resolve(result);
|
||||
if (profile) {
|
||||
profile.messages
|
||||
.find({ 'image': { $exists: true } })
|
||||
.select('image -_id')
|
||||
.exec((err, result) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user