MessageThreadParticipantTrait
Thread detail: an administrator adds another participant (arbiter, other user) or removes one.
Two paths in one form: picking a user with the Picker + "add participant", and the quick
"join the conversation" choice (adds the logged-in administrator). Removal is a separate POST
signal on every active participant. The rules (ceiling, email_only, duplicates, minimum of two
active participants) are held by Api MessageThreadManager::addParticipant() /
removeParticipant(); here only the message is chosen by ResultCode.
Existing participants (their user / role) cannot be changed, only added and removed (a removed row is not deleted, only marked), so it cannot be rewritten afterwards who sent what.
IMPORTANT: the hidden userId is filled by the Picker ({control picker-participantUserId});
the template must not call {input userId} (duplicate hidden input).
IMPORTANT: the action redirects to the detail after success and failure alike (PRG) and the
result is carried by a flash — form-level errors are not rendered.
Table of Contents
Methods
- handleRemoveParticipant() : void
- Removes a participant. POST + same origin (Nette signal) — a link from a foreign page or a GET removes nothing; the `edit` gate already ran in `actionEdit()` and is repeated here for readability.
- createComponentParticipantForm() : Form
- flashParticipantResult() : void
- Message by result: success = key `$successKey`, failure = by `ResultCode` (otherwise a generic one).
- participantFormSucceeded() : void
Methods
handleRemoveParticipant()
Removes a participant. POST + same origin (Nette signal) — a link from a foreign page or a GET removes nothing; the `edit` gate already ran in `actionEdit()` and is repeated here for readability.
public
handleRemoveParticipant(int $participantId) : void
Parameters
- $participantId : int
Attributes
- #[Requires]
- $methods: 'POST'
createComponentParticipantForm()
protected
createComponentParticipantForm() : Form
Return values
FormflashParticipantResult()
Message by result: success = key `$successKey`, failure = by `ResultCode` (otherwise a generic one).
private
flashParticipantResult(Result $result, string $successKey) : void
Parameters
- $result : Result
- $successKey : string
participantFormSucceeded()
private
participantFormSucceeded(Form $form, ArrayHash<string|int, mixed> $values) : void
Parameters
- $form : Form
- $values : ArrayHash<string|int, mixed>