Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding reaction to minimized media re-opens it #12765

Closed
AlexVonB opened this issue Nov 29, 2018 · 4 comments · Fixed by #16071
Closed

Adding reaction to minimized media re-opens it #12765

AlexVonB opened this issue Nov 29, 2018 · 4 comments · Fixed by #16071

Comments

@AlexVonB
Copy link

AlexVonB commented Nov 29, 2018

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
@AlexVonB
Copy link
Author

AlexVonB commented Nov 30, 2018

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

msgStream.emit(message.rid, message);

That upserts the message on the client side

upsertMessage({ msg, subscription });

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

RocketChat.models.Messages = new class extends RocketChat.models._Base {

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)

@NikhilM98
Copy link

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.

@himanish-star
Copy link

@tassoevan could I work on this issue?

@tassoevan
Copy link
Contributor

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

himanish-star added a commit to himanish-star/Rocket.Chat that referenced this issue Jan 14, 2019
Retrived collapsed status from ChatMessage and added it as a parameter in ChatMessage.upsert(..)
fixes: RocketChat#12765
himanish-star added a commit to himanish-star/Rocket.Chat that referenced this issue Jan 14, 2019
Retrived collapsed status from ChatMessage and added it as a parameter in ChatMessage.upsert(..)
fixes: RocketChat#12765
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants