mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
* Players able to flag their own messages * Modify test case to match the new behavior * Remove a comment and a locales message
This commit is contained in:
committed by
Blade Barringer
parent
bbe4759691
commit
f5f8f8c246
@@ -53,7 +53,6 @@
|
|||||||
"messageGroupCannotRemoveSelf": "You cannot remove yourself!",
|
"messageGroupCannotRemoveSelf": "You cannot remove yourself!",
|
||||||
"messageGroupChatBlankMessage": "You cannot send a blank message",
|
"messageGroupChatBlankMessage": "You cannot send a blank message",
|
||||||
"messageGroupChatLikeOwnMessage": "Can't like your own message. Don't be that person.",
|
"messageGroupChatLikeOwnMessage": "Can't like your own message. Don't be that person.",
|
||||||
"messageGroupChatFlagOwnMessage": "Can't report your own message.",
|
|
||||||
"messageGroupChatFlagAlreadyReported": "You have already reported this message",
|
"messageGroupChatFlagAlreadyReported": "You have already reported this message",
|
||||||
"messageGroupChatNotFound": "Message not found!",
|
"messageGroupChatNotFound": "Message not found!",
|
||||||
"messageGroupChatAdminClearFlagCount": "Only an admin can clear the flag count!",
|
"messageGroupChatAdminClearFlagCount": "Only an admin can clear the flag count!",
|
||||||
|
|||||||
@@ -29,14 +29,9 @@ describe('POST /chat/:chatId/flag', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Returns an error when user tries to flag their own message', async () => {
|
it('Allows players to flag their own message', async () => {
|
||||||
let message = await user.post(`/groups/${group._id}/chat`, {message: TEST_MESSAGE});
|
let message = await user.post(`/groups/${group._id}/chat`, {message: TEST_MESSAGE});
|
||||||
await expect(user.post(`/groups/${group._id}/chat/${message.message.id}/flag`))
|
await expect(user.post(`/groups/${group._id}/chat/${message.message.id}/flag`)).to.eventually.be.ok;
|
||||||
.to.eventually.be.rejected.and.eql({
|
|
||||||
code: 404,
|
|
||||||
error: 'NotFound',
|
|
||||||
message: t('messageGroupChatFlagOwnMessage'),
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Flags a chat', async () => {
|
it('Flags a chat', async () => {
|
||||||
|
|||||||
@@ -222,8 +222,6 @@ api.flagChat = {
|
|||||||
|
|
||||||
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
||||||
|
|
||||||
if (message.uuid === user._id) throw new NotFound(res.t('messageGroupChatFlagOwnMessage'));
|
|
||||||
|
|
||||||
let update = {$set: {}};
|
let update = {$set: {}};
|
||||||
|
|
||||||
// Log user ids that have flagged the message
|
// Log user ids that have flagged the message
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ mixin chatMessages(inbox)
|
|||||||
span(ng-if='#{inbox ? "true" : ":: user.contributor.admin || message.uuid == user.id"}')
|
span(ng-if='#{inbox ? "true" : ":: user.contributor.admin || message.uuid == user.id"}')
|
||||||
a(ng-click='#{inbox? "User.deletePM({params:{id:message.$key}})" : "deleteChatMessage(group, message)"}')
|
a(ng-click='#{inbox? "User.deletePM({params:{id:message.$key}})" : "deleteChatMessage(group, message)"}')
|
||||||
span.glyphicon.glyphicon-trash(tooltip=env.t('delete'))
|
span.glyphicon.glyphicon-trash(tooltip=env.t('delete'))
|
||||||
span(ng-if=':: user.contributor.admin || (!message.sent && user.flags.communityGuidelinesAccepted && message.uuid != user.id)')
|
span(ng-if=':: user.contributor.admin || (!message.sent && user.flags.communityGuidelinesAccepted)')
|
||||||
a(ng-click="flagChatMessage(group._id, message)")
|
a(ng-click="flagChatMessage(group._id, message)")
|
||||||
span.glyphicon.glyphicon-flag(tooltip="{{message.flags[user._id] ? env.t('abuseAlreadyReported') : env.t('abuseFlag')}}" ng-class='message.flags[user._id] ? "text-danger" : ""')
|
span.glyphicon.glyphicon-flag(tooltip="{{message.flags[user._id] ? env.t('abuseAlreadyReported') : env.t('abuseFlag')}}" ng-class='message.flags[user._id] ? "text-danger" : ""')
|
||||||
span
|
span
|
||||||
|
|||||||
Reference in New Issue
Block a user