diff options
author | Vitor Mattos <vitor@php.rio> | 2022-08-18 10:04:07 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-18 10:04:07 -0300 |
commit | 08c0b209a575b258078c07de64d700c3a167d0b3 (patch) | |
tree | d8d40d271127f82dbc3b164ef518fcc964b113c0 /lib | |
parent | 5228f51d92963818ea688eb392a56240f20b9b46 (diff) | |
parent | d06d6f625e271c5138477c4d867213ba74b8a4e9 (diff) |
Merge pull request #7771 from nextcloud/bugfix/noid/expose-chat-message-expiration-timestamp
Expose message expiration for chat message objects
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Chat/Parser/SystemMessage.php | 1 | ||||
-rw-r--r-- | lib/Model/Message.php | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index 9cd88747f..3ab91f800 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -461,7 +461,6 @@ class SystemMessage { $hours = $parameters['seconds'] >= 3600 ? (int) round($parameters['seconds'] / 3600) : 0; $minutes = (int) round($parameters['seconds'] / 60); - $parsedParameters['seconds'] = $parameters['seconds']; if ($currentUserIsActor) { if ($weeks > 0) { $parsedMessage = $this->l->n('You set the message expiration to %n week', 'You set the message expiration to %n weeks', $weeks); diff --git a/lib/Model/Message.php b/lib/Model/Message.php index fd14eaaba..60245778c 100644 --- a/lib/Model/Message.php +++ b/lib/Model/Message.php @@ -170,6 +170,8 @@ class Message { } public function toArray(): array { + $expireDate = $this->getComment()->getExpireDate(); + $data = [ 'id' => (int) $this->getComment()->getId(), 'token' => $this->getRoom()->getToken(), @@ -184,6 +186,7 @@ class Message { 'isReplyable' => $this->isReplyable(), 'referenceId' => (string) $this->getComment()->getReferenceId(), 'reactions' => $this->getComment()->getReactions(), + 'expirationTimestamp' => $expireDate ? $expireDate->getTimestamp() : 0, ]; if ($this->getMessageType() === ChatManager::VERB_MESSAGE_DELETED) { |