nioc / xmpp-web

Lightweight web chat client for XMPP server
GNU Affero General Public License v3.0
142 stars 20 forks source link

Support for Message Moderation #82

Closed Ppjet6 closed 1 year ago

Ppjet6 commented 1 year ago

Is your feature request related to a problem? Please describe. When undesirable messages are sent to the channel, it can help being able to retract them.

Describe the solution you'd like https://xmpp.org/extensions/xep-0425.html

Message moderation allows a moderator a room to retract messages so that they are not shown anymore on supporting clients. It also tells servers to tombstone them so they don't reappear when fetching history next time.

As a first step, implementing support in reading (retracting a message in local history when receiving the stanza, or showing the tombstone from the archive) would be enough for joinjabber's use case.

I don't think xmpp-web has a way to attach messages (reactions, replies, etc.) to other messages at the moment so I understand if the sending part is more complex.

Describe alternatives you've considered I don't think there is many alternatives available. Spam messages clogging the chat for example are a pain to workaround, the only available way currently is to let it slide out of screen (after having kicked out the spammer).

nioc commented 1 year ago

Can you link me the XEP / XML message which notify client to remove some spam messages? We can handle it to find and remove spam in store.

Ppjet6 commented 1 year ago

There's a few things that could be improved in this spec, but it works ok..

A Moderated message is a retracted message (XEP-0424) sent by a moderator through MUC.

It requires Iqs to send the command to retract as a moderator, and then messages are broadcasted to participants, so messages with this payload shouldn't come directly from participants. Whenever you see such a payload, make sure the MUC actually advertises urn:xmpp:message-moderate:0 first.

A broadcast message looks like this: https://xmpp.org/extensions/xep-0425.html#usecase-success

And then from MAM you can also get such payloads as specified here: https://xmpp.org/extensions/xep-0425.html#tombstones. You'll need to handle XEP-0424 as above of course, and also https://xmpp.org/extensions/xep-0421.html occupant-id.

Don't hesitate to join xmpp:jdev@muc.xmpp.org?join, I and other devs should be there to answer if you have any questions.

nioc commented 1 year ago

Hello, I do not know how to retract a message with my usual XMPP clients (Gajim 1.3.3 on laptop, Conversation 2.12 on Android).

It there some Prosody plugin required for client show an option? By the way, I am thinking to put some "reproducing environments" in the repo which includes docker-compose.yml and server config files. I will probably ask for your assistance to check/complete the pull request.

Without testing, I can not implement it... 😞

nioc commented 1 year ago

As I explained earlier, it would help me if you could provide the associated Prosody setup in #89.

github-actions[bot] commented 1 year ago

This issue will be closed within two weeks if the requested reproduction data is not provided. Please refer to this guide.

Ppjet6 commented 1 year ago

prosody-moderation.tar.gz

I hope I did it as you expect. I basically pulled the mod_muc_moderation module and added it to the MUC's modules_enabled.

nioc commented 1 year ago

Thanks a lot for this!

I will try to reproduce today. Does Gajim has the moderation function?

Ppjet6 commented 1 year ago

It looks like Gajim, Conversejs, Pade and poezio (sending only) have support for this feature.

nioc commented 1 year ago

I am a noob in thins kind of stuff and I do not find any option in Gajim to retract a message.

Here are the XMPP server functionalities see through Gajim (1.3.3):

image

I have try the room history, then history manager and delete message... but it seems to delete only on Gajim local database (I did not see anything in the websocket, neither in Prosody logs) 😞 image

image

Can you give me the procedure to retract a message in a room?

nioc commented 1 year ago

Okay… I need to update Gajim to 1.4

Both server and client have to support this standard, and you have to be Moderator/Admin/Owner in order to be able to retract messages. Gajim 1.4 will support message moderation in both ways: by offering moderation actions for messages, and by displaying a disclaimer for message which have been moderated.

https://gajim.org/post/2021-11-29-development-news-november/

Ppjet6 commented 1 year ago

If you're using Debian, there's 1.5.1 available in bullseye-backports, otherwise 1.7.1 is available on the upstream repository

nioc commented 1 year ago

Nop Ubuntu (to get newer packages 😆). But I move to Gajim nightly, it is fine.

nioc commented 1 year ago

Here we are, does this UX sound good to you? image

I was wondering if I should hide the message, but the user may wonder why his message disappeared, so reducing opacity should be better, your opinion?

nioc commented 1 year ago

Also another question @Ppjet6, I understand that this only applies to MUC, can you confirm? I would like to use Jid resource instead of the full Jid.

Ppjet6 commented 1 year ago

I think leaving a trail that there was a message here is good. And yes I was going to say, I would just use the nickname (resource) and not the fulljid.

The spec uses "retract" as the verb, I'm not saying it's not possible to use anything else but maybe it makes sense to keep the same terminology here? I don't know what other clients do.

nioc commented 1 year ago

For the wording, I think Retracted is not clear for non RFC-XEP-expert users. If Removed is not ok, I suggest Moderated.

Ppjet6 commented 1 year ago

Ok, both are fine with me. moderated may be more obvious?

nioc commented 1 year ago

Yep. New proposal:

`Moderated by ${nick} (${reason})`

With a red icon at bottom.

image

Ppjet6 commented 1 year ago

The spec isn't explicit about the reason, but I would say it's optional. I would find it weird not to. I've asked around.

nioc commented 1 year ago

I pushed in a branch, so you can review and tell me in the pull request if something is wrong. I will add a few comments to highlight the key points.

Ppjet6 commented 1 year ago

https://mail.jabber.org/pipermail/standards/2023-February/039164.html

Just so you know, this is a thing, and it's possible things change. I'll keep you updated!