Jira bot messages are repeated
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
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.
Looking at the websocket payload you posted, it looks like the post.attachments.fallback and post.attachments.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.
Bug is not visible in the mobile app
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.
I’m wondering what the severity of this issue is. Do you think this is just happening on our community server?