Commit 3dca275c authored by Vitalii Koval's avatar Vitalii Koval Committed by Artem Sylchuk
Browse files

Issue #3337185 by vital_kovalik, artem_sylchuk: Block ability to send messages to yourself

parent aa6c8f13
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -270,6 +270,10 @@ class PrivateMessageForm extends ContentEntityForm {
      }
    }

    if ((count($members) === 1 && $this->currentUser->id() === $members[0]->id()) || empty($members)) {
      $formState->setError($form['members'], $this->t('You can not send a message to yourself only.'));
    }

    if (count($members) <> count($selectedMembers)) {
      $formState->setError($form['members'], $this->t('You can not send a message because there are inactive users selected for this thread.'));
    }