Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(chat)!: Remove threads v1 API changes #9978

Merged
merged 1 commit into from
Jul 17, 2023
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
1 change: 0 additions & 1 deletion docs/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,3 @@
* `typing-privacy` - Support toggle typing privacy

## 18
* `threads` - Chat messages have a thread ID exposed which allows clients to only list chat messages of a dedicated messages stream
1 change: 0 additions & 1 deletion docs/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Base endpoint is: `/ocs/v2.php/apps/spreed/api/v1`: since Nextcloud 13
| field | type | Description |
|-----------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | int | ID of the comment |
| `threadId` | int | ID of the top most parent comment, indicating the thread of this message (`0` for the messages without a parent) (only available with `threads` capability) |
| `token` | string | Conversation token |
| `actorType` | string | See [Constants - Actor types of chat messages](constants.md#actor-types-of-chat-messages) |
| `actorId` | string | Actor id of the message author |
Expand Down
1 change: 0 additions & 1 deletion lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ public function getCapabilities(): array {
'single-conversation-status',
'chat-keep-notifications',
'typing-privacy',
// FIXME Publish once the API is approved by the clients 'threads',
],
'config' => [
'attachments' => [
Expand Down
1 change: 0 additions & 1 deletion lib/Model/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public function toArray(string $format): array {

$data = [
'id' => (int) $this->getComment()->getId(),
'threadId' => (int) $this->getComment()->getTopmostParentId(),
'token' => $this->getRoom()->getToken(),
'actorType' => $this->getActorType(),
'actorId' => $this->getActorId(),
Expand Down
10 changes: 1 addition & 9 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,6 @@ protected function compareDataResponse(TableNode $formData = null) {
$includeReferenceId = in_array('referenceId', $formData->getRow(0), true);
$includeReactions = in_array('reactions', $formData->getRow(0), true);
$includeReactionsSelf = in_array('reactionsSelf', $formData->getRow(0), true);
$includeThreadId = in_array('threadId', $formData->getRow(0), true);

$expected = $formData->getHash();
$count = count($expected);
Expand All @@ -2243,10 +2242,6 @@ protected function compareDataResponse(TableNode $formData = null) {
$messages[$i]['messageParameters'] = 'IGNORE';
}

if ($includeThreadId && !is_numeric($expected[$i]['threadId'])) {
$expected[$i]['threadId'] = self::$textToMessageId[$expected[$i]['threadId']];
}

$result = preg_match('/POLL_ID\(([^)]+)\)/', $expected[$i]['messageParameters'], $matches);
if ($result) {
$expected[$i]['messageParameters'] = str_replace($matches[0], '"' . self::$questionToPollId[$matches[1]] . '"', $expected[$i]['messageParameters']);
Expand All @@ -2260,7 +2255,7 @@ protected function compareDataResponse(TableNode $formData = null) {
}
}

Assert::assertEquals($expected, array_map(function ($message) use ($includeParents, $includeReferenceId, $includeReactions, $includeReactionsSelf, $includeThreadId) {
Assert::assertEquals($expected, array_map(function ($message) use ($includeParents, $includeReferenceId, $includeReactions, $includeReactionsSelf) {
$data = [
'room' => self::$tokenToIdentifier[$message['token']],
'actorType' => $message['actorType'],
Expand All @@ -2287,9 +2282,6 @@ protected function compareDataResponse(TableNode $formData = null) {
$data['reactionsSelf'] = null;
}
}
if ($includeThreadId) {
$data['threadId'] = $message['threadId'];
}
return $data;
}, $messages));
}
Expand Down
Loading