Browse Source

fix status update on member reject, include Chat in socket from approve or reject

push-params
Evan Feenstra 5 years ago
parent
commit
26f6fb7de3
  1. 8
      api/controllers/chatTribes.ts
  2. 9
      dist/api/controllers/chatTribes.js
  3. 2
      dist/api/controllers/chatTribes.js.map

8
api/controllers/chatTribes.ts

@ -305,7 +305,8 @@ export async function receiveMemberApprove(payload) {
socket.sendJson({
type: 'member_approve',
response: {
message: jsonUtils.messageToJson(message, null)
message: jsonUtils.messageToJson(message, null),
chat: jsonUtils.chatToJson(chat),
}
})
@ -333,6 +334,8 @@ export async function receiveMemberApprove(payload) {
export async function receiveMemberReject(payload) {
console.log('=> receiveMemberReject')
const { chat, sender, chat_name } = await helpers.parseReceiveParams(payload)
if(!chat) return console.log('no chat')
await chat.update({status: constants.chat_statuses.rejected})
// dang.. nothing really to do here?
let date = new Date()
date.setMilliseconds(0)
@ -348,7 +351,8 @@ export async function receiveMemberReject(payload) {
socket.sendJson({
type: 'member_reject',
response: {
message: jsonUtils.messageToJson(message, null)
message: jsonUtils.messageToJson(message, null),
chat: jsonUtils.chatToJson(chat),
}
})

9
dist/api/controllers/chatTribes.js

@ -295,7 +295,8 @@ function receiveMemberApprove(payload) {
socket.sendJson({
type: 'member_approve',
response: {
message: jsonUtils.messageToJson(message, null)
message: jsonUtils.messageToJson(message, null),
chat: jsonUtils.chatToJson(chat),
}
});
const amount = chat.priceToJoin || 0;
@ -321,6 +322,9 @@ function receiveMemberReject(payload) {
return __awaiter(this, void 0, void 0, function* () {
console.log('=> receiveMemberReject');
const { chat, sender, chat_name } = yield helpers.parseReceiveParams(payload);
if (!chat)
return console.log('no chat');
yield chat.update({ status: constants.chat_statuses.rejected });
// dang.. nothing really to do here?
let date = new Date();
date.setMilliseconds(0);
@ -336,7 +340,8 @@ function receiveMemberReject(payload) {
socket.sendJson({
type: 'member_reject',
response: {
message: jsonUtils.messageToJson(message, null)
message: jsonUtils.messageToJson(message, null),
chat: jsonUtils.chatToJson(chat),
}
});
hub_1.sendNotification(chat, chat_name, 'reject');

2
dist/api/controllers/chatTribes.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save