Browse Source

fixes

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
84edbe3e1e
  1. 4
      api/controllers/chats.ts
  2. 4
      api/models/ts/chatMember.ts
  3. 7
      api/utils/json.ts
  4. 5
      dist/api/controllers/chats.js
  5. 2
      dist/api/controllers/chats.js.map
  6. 4
      dist/api/models/ts/chatMember.js
  7. 2
      dist/api/models/ts/chatMember.js.map
  8. 10
      dist/api/utils/json.js
  9. 2
      dist/api/utils/json.js.map

4
api/controllers/chats.ts

@ -295,7 +295,9 @@ async function receiveGroupLeave(payload) {
if(isTribeOwner) {
if(chat_type===constants.chat_types.tribe){
await models.ChatMember.destroy({where:{chatId: chat.id, contactId: sender.id}})
try {
await models.ChatMember.destroy({where:{chatId: chat.id, contactId: sender.id}})
} catch(e) {}
}
}
}

4
api/models/ts/chatMember.ts

@ -4,10 +4,10 @@ import { Table, Column, Model } from 'sequelize-typescript';
export default class ChatMember extends Model<ChatMember> {
@Column
chat_id: number
chatId: number
@Column
contact_id: number
contactId: number
@Column
role: number

7
api/utils/json.ts

@ -2,6 +2,7 @@ import {toSnake,toCamel} from '../utils/case'
import * as cronUtils from './cron'
function chatToJson(c) {
if(!c) return {}
const ch = c.dataValues||c
const chat = JSON.parse(JSON.stringify(ch))
let contactIds = chat.contactIds || null
@ -16,6 +17,7 @@ function chatToJson(c) {
}
function messageToJson(msg, chat, contact?) {
if(!msg) return {}
const message = msg.dataValues||msg
let statusMap = message.statusMap || null
if(message.statusMap && typeof message.statusMap==='string'){
@ -29,7 +31,10 @@ function messageToJson(msg, chat, contact?) {
})
}
const contactToJson = (contact) => toSnake(contact.dataValues||contact)
function contactToJson(contact){
if(!contact) return {}
return toSnake(contact.dataValues||contact)
}
const inviteToJson = (invite) => toSnake(invite.dataValues||invite)

5
dist/api/controllers/chats.js

@ -282,7 +282,10 @@ function receiveGroupLeave(payload) {
yield chat.update({ contactIds: JSON.stringify(contactIds) });
if (isTribeOwner) {
if (chat_type === constants.chat_types.tribe) {
yield models_1.models.ChatMember.destroy({ where: { chatId: chat.id, contactId: sender.id } });
try {
yield models_1.models.ChatMember.destroy({ where: { chatId: chat.id, contactId: sender.id } });
}
catch (e) { }
}
}
}

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

File diff suppressed because one or more lines are too long

4
dist/api/models/ts/chatMember.js

@ -15,11 +15,11 @@ let ChatMember = class ChatMember extends sequelize_typescript_1.Model {
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Number)
], ChatMember.prototype, "chat_id", void 0);
], ChatMember.prototype, "chatId", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Number)
], ChatMember.prototype, "contact_id", void 0);
], ChatMember.prototype, "contactId", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Number)

2
dist/api/models/ts/chatMember.js.map

@ -1 +1 @@
{"version":3,"file":"chatMember.js","sourceRoot":"","sources":["../../../../api/models/ts/chatMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA4D;AAG5D,IAAqB,UAAU,GAA/B,MAAqB,UAAW,SAAQ,4BAAiB;CAoBxD,CAAA;AAjBC;IADC,6BAAM;;2CACQ;AAGf;IADC,6BAAM;;8CACW;AAGlB;IADC,6BAAM;;wCACK;AAGZ;IADC,6BAAM;;8CACW;AAGlB;IADC,6BAAM;;iDACc;AAGrB;IADC,6BAAM;8BACK,IAAI;8CAAA;AAlBG,UAAU;IAD9B,4BAAK,CAAC,EAAC,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACxC,UAAU,CAoB9B;kBApBoB,UAAU"}
{"version":3,"file":"chatMember.js","sourceRoot":"","sources":["../../../../api/models/ts/chatMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA4D;AAG5D,IAAqB,UAAU,GAA/B,MAAqB,UAAW,SAAQ,4BAAiB;CAoBxD,CAAA;AAjBC;IADC,6BAAM;;0CACO;AAGd;IADC,6BAAM;;6CACU;AAGjB;IADC,6BAAM;;wCACK;AAGZ;IADC,6BAAM;;8CACW;AAGlB;IADC,6BAAM;;iDACc;AAGrB;IADC,6BAAM;8BACK,IAAI;8CAAA;AAlBG,UAAU;IAD9B,4BAAK,CAAC,EAAC,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACxC,UAAU,CAoB9B;kBApBoB,UAAU"}

10
dist/api/utils/json.js

@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
const case_1 = require("../utils/case");
const cronUtils = require("./cron");
function chatToJson(c) {
if (!c)
return {};
const ch = c.dataValues || c;
const chat = JSON.parse(JSON.stringify(ch));
let contactIds = chat.contactIds || null;
@ -14,6 +16,8 @@ function chatToJson(c) {
}
exports.chatToJson = chatToJson;
function messageToJson(msg, chat, contact) {
if (!msg)
return {};
const message = msg.dataValues || msg;
let statusMap = message.statusMap || null;
if (message.statusMap && typeof message.statusMap === 'string') {
@ -22,7 +26,11 @@ function messageToJson(msg, chat, contact) {
return case_1.toSnake(Object.assign(Object.assign({}, message), { statusMap, chat: chat ? chatToJson(chat) : null, contact: contact ? contactToJson(contact) : null }));
}
exports.messageToJson = messageToJson;
const contactToJson = (contact) => case_1.toSnake(contact.dataValues || contact);
function contactToJson(contact) {
if (!contact)
return {};
return case_1.toSnake(contact.dataValues || contact);
}
exports.contactToJson = contactToJson;
const inviteToJson = (invite) => case_1.toSnake(invite.dataValues || invite);
exports.inviteToJson = inviteToJson;

2
dist/api/utils/json.js.map

@ -1 +1 @@
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../api/utils/json.ts"],"names":[],"mappings":";;AAAA,wCAA6C;AAC7C,oCAAmC;AAEnC,SAAS,UAAU,CAAC,CAAC;IACnB,MAAM,EAAE,GAAG,CAAC,CAAC,UAAU,IAAE,CAAC,CAAA;IAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3C,IAAI,UAAU,GAAG,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