|
|
@ -255,7 +255,7 @@ Channel.writePrivateMessage = function (Env, args, _cb, Server, netfluxId) {
|
|
|
|
var allowed = HK.listAllowedUsers(metadata);
|
|
|
|
var allowed = HK.listAllowedUsers(metadata);
|
|
|
|
|
|
|
|
|
|
|
|
// Special broadcast channel
|
|
|
|
// Special broadcast channel
|
|
|
|
if (channelId === '00000000000000000000000000000000') {
|
|
|
|
if (channelId.length === HK.ADMIN_CHANNEL_LENGTH) {
|
|
|
|
allowed = Env.admins;
|
|
|
|
allowed = Env.admins;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -283,12 +283,19 @@ Channel.writePrivateMessage = function (Env, args, _cb, Server, netfluxId) {
|
|
|
|
|
|
|
|
|
|
|
|
// historyKeeper already knows how to handle metadata and message validation, so we just pass it off here
|
|
|
|
// historyKeeper already knows how to handle metadata and message validation, so we just pass it off here
|
|
|
|
// if the message isn't valid it won't be stored.
|
|
|
|
// if the message isn't valid it won't be stored.
|
|
|
|
Env.historyKeeper.channelMessage(Server, channelStruct, fullMessage);
|
|
|
|
Env.historyKeeper.channelMessage(Server, channelStruct, fullMessage, function (err) {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
// Message not stored...
|
|
|
|
|
|
|
|
return void cb(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Server.getChannelUserList(channelId).forEach(function (userId) {
|
|
|
|
// Broadcast the message
|
|
|
|
Server.send(userId, fullMessage);
|
|
|
|
Server.getChannelUserList(channelId).forEach(function (userId) {
|
|
|
|
|
|
|
|
Server.send(userId, fullMessage);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|