Jira bot messages are repeated

Description

Observed in community-daily, desktop app 4.6.0 on Mac OS 10.15.7

A post created by the jira bot looks like it posted several times. The problem disappears after restarting the desktop app.

QA Test Steps

None

Activity

Show:
Michael Kochell
December 11, 2020, 4:02 AM

I’m wondering what the severity of this issue is. Do you think this is just happening on our community server?

Harrison Healey
December 11, 2020, 5:05 AM

I'm unsure of that. I haven't tried setting up the Jira integration on any other servers.

I just reproduced this on community-daily and captured the websocket event sent to the client for it. For some reason, the event contains a post with the message duplicated many times, so it's not a client issue. I attached the JSON for that event.

Elias Nahum
December 19, 2020, 11:45 AM

Bug is not visible in the mobile app

Michael Kochell
December 21, 2020, 5:57 PM

Looking at the websocket payload you posted, it looks like the post.attachments[0].fallback and post.attachments[0].pretext are formatted correctly, and only the post.message is affected by this issue (probably obvious, just stating here for discussion).

The post.message begins with \n and then repeats the message 14 times with a \n between each repetition. I searched through the mattermost-server code to see if any \n's may be hardcoded and added under some conditions, but I didn’t see anything relevant. I didn’t really expect to find anything though.

For the occurrence discussed here, it seems the issue does not specifically involve the Jira plugin. Also, when I view the post, I’m not seeing the message above the attachment, let alone being repeated multiple times. When I look in the React dev tools, I see the post.messageis blank. Very strange behavior.

If this occurs in certain websocket events, but goes away after refresh, this likely means that the issue is not persisted to the database, and may be caused by some post-processing logic before the message is sent over websockets. I have gone through the code from Plugin API → CreatePost → PreparePostForClient and haven’t seen any code that is modifying post.messagethat may cause this issue. I’ll have a more thorough look in the code paths to see if there’s something I’ve missed, possibly in the enterprise repo as well.

I was thinking maybe there is a plugin using a hook such as MessageWillBePostedthat is causing this, but that would affect the persisted post, so I don’t think that is the cause.

Dylan Haussermann
December 22, 2020, 4:36 AM

FWIW - I have tested this on my local as well as on a server created via the cloud portal and I have not been able to repro it.
Based on what I see on Community, I believe this is being delivered with a legacy hook and not a subscription. I also think it happens when an assignee is set (which is very strange). But even when matching these details I have not been able to reproduce the issue.

Mana

None

Assignee

Unassigned

QA Assignee

None

Reporter

Ibrahim Acikgoz

Epic Link

None

Fix versions

Mattermost Team

Integrations

Sprint

None

Labels

QA Testing Areas

None

GitHub Issue

None

Components

None

Severity

None