Browse Source

fix unhandled exception

loopout2 1.0.10
Evan Feenstra 4 years ago
parent
commit
740f0b8eda
  1. 6
      .babelrc
  2. BIN
      binaries/node_sqlite3.node
  3. 19
      dist/src/controllers/messages.js
  4. 2
      dist/src/controllers/messages.js.map
  5. 22
      src/controllers/messages.ts

6
.babelrc

@ -1,6 +0,0 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}

BIN
binaries/node_sqlite3.node

Binary file not shown.

19
dist/src/controllers/messages.js

@ -257,13 +257,18 @@ exports.readMessages = (req, res) => __awaiter(void 0, void 0, void 0, function*
}
});
const chat = yield models_1.models.Chat.findOne({ where: { id: chat_id } });
yield chat.update({ seen: true });
res_1.success(res, {});
hub_1.sendNotification(chat, '', 'badge');
socket.sendJson({
type: 'chat_seen',
response: jsonUtils.chatToJson(chat)
});
if (chat) {
yield chat.update({ seen: true });
res_1.success(res, {});
hub_1.sendNotification(chat, '', 'badge');
socket.sendJson({
type: 'chat_seen',
response: jsonUtils.chatToJson(chat)
});
}
else {
res_1.failure(res, 'no chat');
}
});
exports.clearMessages = (req, res) => {
models_1.models.Message.destroy({ where: {}, truncate: true });

2
dist/src/controllers/messages.js.map

File diff suppressed because one or more lines are too long

22
src/controllers/messages.ts

@ -5,7 +5,7 @@ import { sendNotification } from '../hub'
import * as socket from '../utils/socket'
import * as jsonUtils from '../utils/json'
import * as helpers from '../helpers'
import { success } from '../utils/res'
import { failure, success } from '../utils/res'
import * as timers from '../utils/timers'
import {sendConfirmation} from './confirmations'
import * as network from '../network'
@ -288,15 +288,17 @@ export const readMessages = async (req, res) => {
}
});
const chat = await models.Chat.findOne({ where: { id: chat_id } })
await chat.update({ seen: true });
success(res, {})
sendNotification(chat, '', 'badge')
socket.sendJson({
type: 'chat_seen',
response: jsonUtils.chatToJson(chat)
})
if(chat) {
await chat.update({ seen: true });
success(res, {})
sendNotification(chat, '', 'badge')
socket.sendJson({
type: 'chat_seen',
response: jsonUtils.chatToJson(chat)
})
} else {
failure(res, 'no chat')
}
}
export const clearMessages = (req, res) => {

Loading…
Cancel
Save