|
|
@ -172,6 +172,14 @@ Messaging.getRecentChats = function (callerUid, uid, start, stop, callback) {
|
|
|
|
|
|
|
|
|
|
|
|
next(null, { rooms: results.roomData, nextStart: stop + 1 });
|
|
|
|
next(null, { rooms: results.roomData, nextStart: stop + 1 });
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
function (ref, next) {
|
|
|
|
|
|
|
|
plugins.fireHook('filter:messaging.getRecentChats', {
|
|
|
|
|
|
|
|
rooms: ref.rooms,
|
|
|
|
|
|
|
|
nextStart: ref.nextStart,
|
|
|
|
|
|
|
|
uid: uid,
|
|
|
|
|
|
|
|
callerUid: callerUid,
|
|
|
|
|
|
|
|
}, next);
|
|
|
|
|
|
|
|
},
|
|
|
|
], callback);
|
|
|
|
], callback);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -252,11 +260,16 @@ Messaging.canMessageUser = function (uid, toUid, callback) {
|
|
|
|
}, next);
|
|
|
|
}, next);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function (results, next) {
|
|
|
|
function (results, next) {
|
|
|
|
if (!results.settings.restrictChat || results.isAdmin || results.isFollowing) {
|
|
|
|
if (results.settings.restrictChat && !results.isAdmin && !results.isFollowing) {
|
|
|
|
return next();
|
|
|
|
return next(new Error('[[error:chat-restricted]]'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
next(new Error('[[error:chat-restricted]]'));
|
|
|
|
plugins.fireHook('static:messaging.canMessageUser', {
|
|
|
|
|
|
|
|
uid: uid,
|
|
|
|
|
|
|
|
toUid: toUid,
|
|
|
|
|
|
|
|
}, function (err) {
|
|
|
|
|
|
|
|
next(err);
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
], callback);
|
|
|
|
], callback);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -293,7 +306,12 @@ Messaging.canMessageRoom = function (uid, roomId, callback) {
|
|
|
|
return next(new Error('[[error:email-not-confirmed-chat]]'));
|
|
|
|
return next(new Error('[[error:email-not-confirmed-chat]]'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
next();
|
|
|
|
plugins.fireHook('static:messaging.canMessageRoom', {
|
|
|
|
|
|
|
|
uid: uid,
|
|
|
|
|
|
|
|
roomId: roomId,
|
|
|
|
|
|
|
|
}, function (err) {
|
|
|
|
|
|
|
|
next(err);
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
], callback);
|
|
|
|
], callback);
|
|
|
|
};
|
|
|
|
};
|
|
|
|