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

Delete button message #189

Closed
wants to merge 2 commits into from
Closed

Delete button message #189

wants to merge 2 commits into from

Conversation

rockhouse
Copy link
Contributor

This implements a delete button next to the edit button. When it's pressed a sweetAlarm (as discussed with @sampaiodiego) modal is presented to acknowledge or cancel. The entry is deleted from both server and client mini mongo but somehow jumps to the top of the chat and a full refresh is necessary to get rid of the message, any ideas why that is?

@sampaiodiego
Copy link
Member

hey @rockhouse , thanks for the PR..

But, your code seems outdated.. Your PR is removing some functionality already on master. Can you take a look on this?

About your question, this behavior is how our message reactivity works.. Look at this code: https://github.com/RocketChat/Rocket.Chat/blob/master/client%2Flib%2Fcollections.coffee#L14-L16

And, I think you shoud not delete the message record. In discussion with other members of the dev team, we think you should do the follow:

  • Set the 'msg' field to blank
  • Set a field with the timestamp of the action (I guess a 'dts' field, like 'ets' of edited message)
  • On screen you should test if this timestamp field exists and show "this message has been deleted". Like this:

image

What you think?

I'm sorry for not thinking on this before.. I think we should discussed this on an issue before you start coding =(

@rockhouse
Copy link
Contributor Author

hi @sampaiodiego,

thanks for the quick feedback. PR should be up to date now! Let me know if not.

Regarding the behaviour, thanks for the pointer I think I understand the problem now. The msg is actually added back to ChatMessageHistory and that is then displayed at the top of the chat again as that collection is reactive as well and triggers the addition back to the top. I guess the oplog listener to remove should be deleted as deleted messages should not be showing up anyhow, right? Or am I missing something, is the remove used somewhere else?

Then I guess it is time to have this discussion now :)

It looks a little over engineered to just delete a message don't you think? If we set it to blank than I don't understand what the added value is to keep the message in the DB. But maybe I am missing something.
Just as a side remark the big brother we are trying to imitate here also just deletes the message with no reference to "This message has been deleted" :)
And it really gives me the feeling as if I had to hide something with that text :) I guess I would always just use the edit functionality and set it to something else and then the whole point of the delete button is gone ;)

Let's discuss! :D

@engelgabriel
Copy link
Member

Hi, I have a mixed feeling about this too. I generally don't like the idea of things disappearing completely, I may be very confusing for users... in so many situations. If you KNOW you read somethings, or received a sound alert for a new message... and it gets deleted.. you will think that there was a bug or something if you can't find ANY indication of what happened.

@rodrigok
Copy link
Member

Maybe the message can be marked as deleted to show something to users and then deleted after a certain time like 24h.

@engelgabriel
Copy link
Member

I'd first try just to mark as deleted... and see what people think of it.

@nivoc
Copy link

nivoc commented Jun 17, 2015

+1 for full delete
@engelgabriel are your mixed feelings technical or fully ui experience related?

Slack's default behaviour is a full delete without message and I like this behavior because it delivers a cleaner experience. And the history is already "untrusted" - I mean everyone can change all this messages even years ago to whatever he wants. Slack even goes further and if you edit a message to black it suggests a full remove without message.

Note: But Slack allows to change the default behaviour. The admin can disable edit's and deletes in the settings for a secure history.

@engelgabriel
Copy link
Member

I guess the KEY here is configuration. We must support both behaviour and make it configurable.

@sampaiodiego
Copy link
Member

we must support two behaviors, but we must choose the default one.

how the code are at moment, it may be difficult to simply remove the message, because of how message reactivity and history were implemented.

so, maybe updating the message should be easiest way to accomplish the feature until the "blaze refactoring" be done.

@engelgabriel
Copy link
Member

Agreed with @sampaiodiego

@rockhouse
Copy link
Contributor Author

just for my understanding @sampaiodiego why are those lines needed:
https://github.com/RocketChat/Rocket.Chat/blob/master/client%2Flib%2Fcollections.coffee#L14-L16

As far as I could tell it does not make sense to add a deleted item to the ChatHistory, but maybe I am missing something?

If it is not needed there is no code reason why the implementation of the delete functionality could not move forward as proposed and adjusted later?

What do you think?

@sampaiodiego
Copy link
Member

so @rockhouse .. the message subscription (here) only sends 50 messages to client. this means that only the last 50 messages will be "reactive".

so when a new message is sent, the last message of this "merge box" will be discarted, but the client still wants to show it.. this is what the code you asked for do. it "catches" the messages discarted by the server and put it in another local collection (ChatMessageHistory), so the view can still show the message, even if it isn't on the merge box anymore.. this means this message isn't reactive too.

you get it?

this implementation was a try to solve some load issues.. have too many messages on server merge box is really pain, for example, it uses too many memory and cpu.. but this could not be best way to achieve this result..

confirmation

The trigger for remove is not needed in building the ChatHistory and
would otherwise interfer with the delete message function
@rockhouse
Copy link
Contributor Author

I completely get it :) thanks for the explanation!

I adjusted my changes so it can delete messages and does not destroy the reactivity :) I made a little change and update the entry before and remove the rid then we delete. In the reactive code we check for the remove trigger but can filter on rid and leave it out.

What do you think?

@rockhouse
Copy link
Contributor Author

Due to modifications on message rendering I will reimplement the delete functionality on the new code base and make a new pull request as discussed with @sampaiodiego.

@rockhouse rockhouse closed this Jun 25, 2015
@rockhouse rockhouse deleted the deleteButtonMessage branch June 25, 2015 20:13
HappyTobi pushed a commit to HappyTobi/Rocket.Chat that referenced this pull request Jul 10, 2018
use electron-builder's install-app-deps, drop native-module stuff
Shailesh351 pushed a commit to Shailesh351/Rocket.Chat that referenced this pull request Mar 24, 2020
…_width

Fix Sidebar Width not proper when last msg is very Long
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants