Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/GetStream/StreamChat/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,16 @@ public function deleteMessage(string $messageId, array $options = []): StreamRes
return $this->delete("messages/" . $messageId, $options);
}

/**
* Undeletes a message.
* @link https://getstream.io/chat/docs/php/send_message/?language=php
* @throws StreamException
*/
public function undeleteMessage(string $messageId, string $userId): StreamResponse
{
return $this->post("messages/" . urlencode($messageId) . "/undelete", ["undeleted_by" => $userId]);
}

/** Allows you to search for users and see if they are online/offline.
* You can filter and sort on the custom fields you've set for your user, the user id, and when the user was last active.
* @link https://getstream.io/chat/docs/php/query_users/?language=php
Expand Down
9 changes: 9 additions & 0 deletions tests/integration/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,15 @@ public function testDeleteMessage()
$this->client->deleteMessage($msgId);
}

public function testUnDeleteMessage()
{
$msgId = $this->generateGuid();
$msg = ["id" => $msgId, "text" => "helloworld"];
$this->channel->sendMessage($msg, $this->user1["id"]);
$this->client->deleteMessage($msgId);
$this->client->undeleteMessage($msgId, $this->user1["id"]);
}

public function testManyMessages()
{
$msgId = $this->generateGuid();
Expand Down
Loading