- Issue created by @Qusai Taha
- Issue was unassigned.
- Status changed to Needs review
almost 2 years ago 6:03am 2 February 2023 - Merge request !5Issue #3338480: Add the ability to send messages to multiple users → (Closed) created by Qusai Taha
- 🇨🇿Czech Republic viperror
If I applied this patch #2, i ve got message warning: 1 line adds whitespace errors. When I tried go to write new message url, I have this error: Symfony\Component\Routing\Exception\RouteNotFoundException: Route "privatemsg.participants_searchautocomplete" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of core\lib\Drupal\Core\Routing\RouteProvider.php).
- 🇻🇳Vietnam tra.duong
@viperror The patch add routing, you need to clear the cache to recognize new route.
@Qusai Taha, your patch contains error.
in src/Form/CreateThreadForm.php i/src/Form/CreateThreadForm.php... + // Split search users. + $recipients = explode(", ", $form_state->getValue('to')); <-- CHECK + $recipients_id = [];
Note: User's input, better split by comma, not followed by any space.
+ ->condition('name', $recipient, "="); <-- CHECK
Note: very dangerous
1. SQL injection may happen here.
2. Because this is user's input, a trim() on $recipient is good.+ $recipient_id = $query->execute()->fetchCol(); <-- CHECK + + if (empty($recipient_id)) {
Note: Query produce array/boolean
+ $this->messenger()->addError($this->t('There a user name is not valid, please make sure to enter a valid user name.')); <-- CHECK + }
Note:
-> the error message is not correct.
-> Consider log errors and send message once the check name is done,
-> Showing which name is error is awesome here too.+ else { + $recipients_id[] = $recipient_id; <-- CHECK + } ...
Note: here produce multiple dimension array
It will let this piece of code error+ if (!empty($recipients_id)) { + if (count($recipients_id) > 1) { + foreach($recipients_id as $recipient_id) { + $thread_id = $this->privateMsgService->createThread($author_id, $subject, $body_value, $format, $recipient_id); <-- CHECK + }
Note: $recipient_id is array, not int
- Status changed to Needs work
over 1 year ago 12:18pm 27 April 2023 - ivnish Kazakhstan
New major version release is coming soon (with drupal entities). This issue already fixed there.
- Status changed to Fixed
over 1 year ago 6:56am 3 August 2023 When someone adds you to a multi-user conversation, how do you leave that message thread? What should you do if you don't want to disable the private message completely but want to leave this thread?
Since you cannot leave, you continue to receive all the message notifications that you do not want.- ivnish Kazakhstan
There is no this functionality now. But thanks for the idea!
Automatically closed - issue fixed for 2 weeks with no activity.