Chore: Change error message when marking empty chat as unread (#20250)

pull/20135/head^2
Lucas Sartor Chauvin 5 years ago committed by GitHub
parent b2ecfa83ff
commit 2aaa37d7a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/message-mark-as-unread/server/unreadMessages.js
  2. 1
      packages/rocketchat-i18n/i18n/en.i18n.json
  3. 1
      packages/rocketchat-i18n/i18n/pt-BR.i18n.json
  4. 14
      tests/end-to-end/api/10-subscriptions.js

@ -16,7 +16,7 @@ Meteor.methods({
const lastMessage = Messages.findVisibleByRoomId(room, { limit: 1, sort: { ts: -1 } }).fetch()[0];
if (lastMessage == null) {
throw new Meteor.Error('error-action-not-allowed', 'Not allowed', {
throw new Meteor.Error('error-no-message-for-unread', 'There are no messages to mark unread', {
method: 'unreadMessages',
action: 'Unread_messages',
});

@ -1609,6 +1609,7 @@
"error-message-size-exceeded": "Message size exceeds Message_MaxAllowedSize",
"error-missing-unsubscribe-link": "You must provide the [unsubscribe] link.",
"error-no-tokens-for-this-user": "There are no tokens for this user",
"error-no-message-for-unread": "There are no messages to mark unread",
"error-not-allowed": "Not allowed",
"error-not-authorized": "Not authorized",
"error-office-hours-are-closed": "The office hours are closed.",

@ -1425,6 +1425,7 @@
"error-message-editing-blocked": "Edição de mensagens está bloqueada",
"error-message-size-exceeded": "O tamanho da mensagem excede Message_MaxAllowedSize",
"error-missing-unsubscribe-link": "Você deve fornecer o link para desinscrever-se: [unsubscribe].",
"error-no-message-for-unread": "Não há mensagens para serem marcadas como não lidas",
"error-no-tokens-for-this-user": "Não existem tokens para este usuário",
"error-not-allowed": "Não permitido",
"error-not-authorized": "Não autorizado",

@ -214,6 +214,20 @@ describe('[Subscriptions]', function() {
done();
});
});
it('should fail when there are no messages on an channel', (done) => {
request.post(api('subscriptions.unread'))
.set(credentials)
.send({
roomId: testChannel._id,
})
.expect(400)
.expect((res) => {
expect(res.body).to.have.property('success', false);
expect(res.body).to.have.property('error');
expect(res.body).to.have.property('errorType', 'error-no-message-for-unread');
})
.end(done);
});
it('sending message', (done) => {
request.post(api('chat.sendMessage'))
.set(credentials)

Loading…
Cancel
Save