diff options
author | Joas Schilling <coding@schilljs.com> | 2022-04-07 17:49:03 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-04-07 17:49:03 +0300 |
commit | 55ace3d96773c446623b79750aee101c77eb8f6f (patch) | |
tree | 0f5939191a0cac421882ad3071040872bc22ba52 /lib/Model | |
parent | 06d2432f89e6e08343545b3e19bd814df7ebb478 (diff) |
Message types are defaulting to Verbs so lets reuse the constantstechdebt/7078/const-for-verbs
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Model')
-rw-r--r-- | lib/Model/Message.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Model/Message.php b/lib/Model/Message.php index 118adad72..fd14eaaba 100644 --- a/lib/Model/Message.php +++ b/lib/Model/Message.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace OCA\Talk\Model; +use OCA\Talk\Chat\ChatManager; use OCA\Talk\Participant; use OCA\Talk\Room; use OCP\Comments\IComment; @@ -160,10 +161,11 @@ class Message { return false; } - return $this->getMessageType() !== 'system' && - $this->getMessageType() !== 'command' && - $this->getMessageType() !== 'comment_deleted' && - $this->getMessageType() !== 'reaction' && + return $this->getMessageType() !== ChatManager::VERB_SYSTEM && + $this->getMessageType() !== ChatManager::VERB_COMMAND && + $this->getMessageType() !== ChatManager::VERB_MESSAGE_DELETED && + $this->getMessageType() !== ChatManager::VERB_REACTION && + $this->getMessageType() !== ChatManager::VERB_REACTION_DELETED && \in_array($this->getActorType(), [Attendee::ACTOR_USERS, Attendee::ACTOR_GUESTS]); } @@ -177,14 +179,14 @@ class Message { 'timestamp' => $this->getComment()->getCreationDateTime()->getTimestamp(), 'message' => $this->getMessage(), 'messageParameters' => $this->getMessageParameters(), - 'systemMessage' => $this->getMessageType() === 'system' ? $this->getMessageRaw() : '', + 'systemMessage' => $this->getMessageType() === ChatManager::VERB_SYSTEM ? $this->getMessageRaw() : '', 'messageType' => $this->getMessageType(), 'isReplyable' => $this->isReplyable(), 'referenceId' => (string) $this->getComment()->getReferenceId(), 'reactions' => $this->getComment()->getReactions(), ]; - if ($this->getMessageType() === 'comment_deleted') { + if ($this->getMessageType() === ChatManager::VERB_MESSAGE_DELETED) { $data['deleted'] = true; } |