mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 21:57:22 +01:00
Move Chat to Model (#9703)
* Began moving group chat to separate model * Fixed lint issue * Updated delete chat with new model * Updated flag chat to support model * Updated like chat to use model * Fixed duplicate code and chat messages * Added note about concat chat * Updated clear flags to user new model * Updated more chat checks when loading get group * Fixed spell test and back save * Moved get chat to json method * Updated flagging with new chat model * Added missing await * Fixed chat user styles. Fixed spell group test * Added new model to quest chat and group plan chat * Removed extra timestamps. Added limit check for group plans * Updated tests * Synced id fields * Fixed id creation * Add meta and fixed tests * Fixed group quest accept test * Updated puppeteer * Added migration * Export vars * Updated comments
This commit is contained in:
committed by
Sabe Jones
parent
0ec1a91774
commit
7d7fe6047c
@@ -53,16 +53,26 @@ describe('DELETE /groups/:groupId/chat/:chatId', () => {
|
||||
|
||||
it('allows creator to delete a their message', async () => {
|
||||
await user.del(`/groups/${groupWithChat._id}/chat/${nextMessage.id}`);
|
||||
let messages = await user.get(`/groups/${groupWithChat._id}/chat/`);
|
||||
expect(messages).is.an('array');
|
||||
expect(messages).to.not.include(nextMessage);
|
||||
|
||||
const returnedMessages = await user.get(`/groups/${groupWithChat._id}/chat/`);
|
||||
const messageFromUser = returnedMessages.find(returnedMessage => {
|
||||
return returnedMessage.id === nextMessage.id;
|
||||
});
|
||||
|
||||
expect(returnedMessages).is.an('array');
|
||||
expect(messageFromUser).to.not.exist;
|
||||
});
|
||||
|
||||
it('allows admin to delete another user\'s message', async () => {
|
||||
await admin.del(`/groups/${groupWithChat._id}/chat/${nextMessage.id}`);
|
||||
let messages = await user.get(`/groups/${groupWithChat._id}/chat/`);
|
||||
expect(messages).is.an('array');
|
||||
expect(messages).to.not.include(nextMessage);
|
||||
|
||||
const returnedMessages = await user.get(`/groups/${groupWithChat._id}/chat/`);
|
||||
const messageFromUser = returnedMessages.find(returnedMessage => {
|
||||
return returnedMessage.id === nextMessage.id;
|
||||
});
|
||||
|
||||
expect(returnedMessages).is.an('array');
|
||||
expect(messageFromUser).to.not.exist;
|
||||
});
|
||||
|
||||
it('returns empty when previous message parameter is passed and the last message was deleted', async () => {
|
||||
@@ -71,9 +81,9 @@ describe('DELETE /groups/:groupId/chat/:chatId', () => {
|
||||
});
|
||||
|
||||
it('returns the update chat when previous message parameter is passed and the chat is updated', async () => {
|
||||
let deleteResult = await user.del(`/groups/${groupWithChat._id}/chat/${nextMessage.id}?previousMsg=${message.id}`);
|
||||
const updatedChat = await user.del(`/groups/${groupWithChat._id}/chat/${nextMessage.id}?previousMsg=${message.id}`);
|
||||
|
||||
expect(deleteResult[0].id).to.eql(message.id);
|
||||
expect(updatedChat[0].id).to.eql(message.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user