Problem/Motivation

As site admin I want to be able to delete conversations made by users.
Current status ist, that conversations get deleted if all of the thread members deleted the thread, so that table pm_thread_delete_time contains appropriate information. But there might be a status where it has to be necessary, that the thread must be remove for all thread members.

Steps to reproduce

Create view to manage private message conversations an add link to delete conversation.
As admin use this link to delete thread, but still all members have access to the thread.

Proposed resolution

Thread should be deleted or at least unaccessible to members.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

johannes-maximilian created an issue. See original summary.

drupalfan2’s picture

Is there any solution to delete conversation as admin in the meantime?

id.conky made their first commit to this issue’s fork.

id.conky’s picture

Version: 8.x-2.0-beta16 » 8.x-2.x-dev
Status: Active » Needs review
Issue tags: +LutskGCW22

Hi, I little bit rewritten delete thread stuff.
Added ability to delete thread completely by adding corresponding buttons to confirm form. Separated leave / delete thread methods in entity. Introduced new permission to have ability to delete thread completely.

So steps to delete conversation:

  1. Setup "Delete private message thread for all participants" permission for all required roles.
  2. Login as user who have role above.
  3. Go to "/private-messages/{thread_id}/delete" and you will see "Leave thread" and "Delete thread" options.

So basically "Delete thread" removing thread entity and all it's messages completely.

drupalfan2’s picture

When will this code be available in an official release?

id.conky’s picture

Re-thinked way of how this should work and done that:
1. Created separate forms, so one for complete deletion of thread, second to clear personal chat history.
2. Tuned access control handler class, so to delete thread, you should be admin or be a member of this thread and have permission "delete private message thread for all". To clear personal chat history you just need to be a member of the thread.
3. Added clear history link to thread view.

artem_sylchuk made their first commit to this issue’s fork.

artem_sylchuk’s picture

Version: 8.x-2.x-dev » 3.0.x-dev
Status: Needs review » Fixed

This is a pretty major API update that may break a lot of installation, so changed target to 3.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.