Rocket.chat: Adding reaction to minimized media re-opens it

Created on 29 Nov 2018  路  4Comments  路  Source: RocketChat/Rocket.Chat

Description:

When adding a reaction (emoji) to an image or gif that has been minimized (small black triangle) before, that media will get re-opened on all clients.

Steps to reproduce:

  1. Send image or gif
  2. Minimize media by clicking on the small black triangle
  3. Add any reaction

Expected behavior:

Media does not get maximized

Actual behavior:

Media gets maximized on every client

Server Setup Information:

  • Version of Rocket.Chat Server: 0.72.0
  • Operating System: Ubuntu 16.04
  • Deployment Method: tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: n/a
  • NodeJS Version: 8.9.3 - x64
  • MongoDB Version: 3.6.7
easy uux bug

All 4 comments

I guess the server emits the message, after it was reacted to:

https://github.com/RocketChat/Rocket.Chat/blob/70fe7df1187ca26422b4f02decb41982a9520b3a/packages/rocketchat-reactions/setReaction.js#L96

That upserts the message on the client side

https://github.com/RocketChat/Rocket.Chat/blob/9289e5b7bed03cf4f62dc281a8e7ab2b7fba725f/packages/rocketchat-ui/client/lib/RoomManager.js#L61

while the collapsed-status is not saved in the model:

https://github.com/RocketChat/Rocket.Chat/blob/70fe7df1187ca26422b4f02decb41982a9520b3a/packages/rocketchat-lib/server/models/Messages.js#L5

causing the collapsed-status to be reset.

A solution could be to add the collapsed-status to the message model (unfortunately this is where my JS/Meteor ends)

I'm not that familiar with Rocket.Chat codebase enough, but I think that adding collapsed-status to the message model would not be the best choice. We don't want the collapse-status of a person to be stored in the server or to affect the collapse-status of another client.

Collapse-status should be stored on the client side and the client should decide that whether to collapseMediaByDefault or not.

The problem, in this case, is that when a person reacts on a media. An event is published from the server which makes the 'rocketchat-message-attachments' component re-render on the client side. When that component re-renders it checks for 'unless mediaCollapsed' status which returns true and the expanded image is rendered.

I'm not sure what's making this.collapsed of Template.messageAttachment to reset.

I'm new to Rocket.Chat and I would like to work on this issue. It would be great if someone from Rocket.Chat community could mentor me.

@tassoevan could I work on this issue?

@himanish-star 馃弫Go ahead! Contact me if you need some help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

engelgabriel picture engelgabriel  路  3Comments

brendanheywood picture brendanheywood  路  3Comments

Kiran-Rao picture Kiran-Rao  路  3Comments

antn89 picture antn89  路  3Comments

mddvul22 picture mddvul22  路  3Comments