Browse Source

cant join the same tribe twice

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
c8191ddba1
  1. 7
      api/controllers/chats.ts
  2. 5
      dist/api/controllers/chats.js
  3. 2
      dist/api/controllers/chats.js.map

7
api/controllers/chats.ts

@ -173,6 +173,13 @@ const deleteChat = async (req, res) => {
async function joinTribe(req, res){
console.log('=> joinTribe')
const { uuid, group_key, name, host } = req.body
const existing = await models.Chat.findOne({where:{uuid}})
if(existing) {
console.log('[tribes] u are already in this group')
return
}
const ownerPubKey = await tribes.verifySignedTimestamp(uuid)
const tribeOwner = await models.Contact.findOne({ where: { publicKey: ownerPubKey } })

5
dist/api/controllers/chats.js

@ -164,6 +164,11 @@ function joinTribe(req, res) {
return __awaiter(this, void 0, void 0, function* () {
console.log('=> joinTribe');
const { uuid, group_key, name, host } = req.body;
const existing = yield models_1.models.Chat.findOne({ where: { uuid } });
if (existing) {
console.log('[tribes] u are already in this group');
return;
}
const ownerPubKey = yield tribes.verifySignedTimestamp(uuid);
const tribeOwner = yield models_1.models.Contact.findOne({ where: { publicKey: ownerPubKey } });
let theTribeOwner;

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

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