mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
allow liking their own message (#15117)
This commit is contained in:
@@ -232,7 +232,6 @@ api.postChat = {
|
||||
* @apiUse MessageNotFound
|
||||
* @apiUse GroupIdRequired
|
||||
* @apiUse ChatIdRequired
|
||||
* @apiError (400) {NotFound} messageGroupChatLikeOwnMessage A user can't like their own message
|
||||
*/
|
||||
api.likeChat = {
|
||||
method: 'POST',
|
||||
@@ -253,10 +252,8 @@ api.likeChat = {
|
||||
|
||||
const message = await Chat.findOne({ _id: req.params.chatId }).exec();
|
||||
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
||||
// @TODO correct this error type
|
||||
if (message.uuid === user._id) throw new NotFound(res.t('messageGroupChatLikeOwnMessage'));
|
||||
|
||||
if (!message.likes) message.likes = {};
|
||||
|
||||
message.likes[user._id] = !message.likes[user._id];
|
||||
message.markModified('likes');
|
||||
await message.save();
|
||||
|
||||
Reference in New Issue
Block a user