Browse Source
Add a flag to messages if they can be replied to
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/2497/head
Joas Schilling
6 years ago
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
7 changed files with
19 additions and
5 deletions
-
docs/capabilities.md
-
docs/chat.md
-
lib/Capabilities.php
-
lib/Controller/ChatController.php
-
lib/Controller/RoomController.php
-
src/components/MessagesList/MessagesGroup/Message/Message.vue
-
tests/php/CapabilitiesTest.php
|
|
@ -37,3 +37,7 @@ title: Capabilities |
|
|
|
* `chat-read-marker` - The chat can be optionally marked read by clients manually, independent from the loading of the chat messages. |
|
|
|
* `webinary-lobby` - See [Webinary management](webinary.md) for technical details. |
|
|
|
* `start-call-flag` - Only moderators or users might be able to start calls. |
|
|
|
|
|
|
|
|
|
|
|
## 8.0 |
|
|
|
* `chat-replies` - Normal chat messages can now be replied to. Check the `isReplyable` parameter on the message object. |
|
|
@ -43,6 +43,7 @@ Base endpoint is: `/ocs/v2.php/apps/spreed/api/v1` |
|
|
|
`timestamp` | int | Timestamp in seconds and UTC time zone |
|
|
|
`systemMessage` | string | empty for normal chat message or the type of the system message (untranslated) |
|
|
|
`messageType` | string | Currently known types are `comment`, `system` and `command` |
|
|
|
`isReplyable` | bool | True if the user can post a reply to this message (only available with `chat-replies` capability) |
|
|
|
`message` | string | Message string with placeholders (see [Rich Object String](https://github.com/nextcloud/server/issues/1706)) |
|
|
|
`messageParameters` | array | Message parameters for `message` (see [Rich Object String](https://github.com/nextcloud/server/issues/1706)) |
|
|
|
|
|
|
|
|
|
@ -81,6 +81,7 @@ class Capabilities implements IPublicCapability { |
|
|
|
'chat-read-marker', |
|
|
|
'webinary-lobby', |
|
|
|
'start-call-flag', |
|
|
|
'chat-replies', |
|
|
|
], |
|
|
|
'config' => [ |
|
|
|
'chat' => [ |
|
|
|
|
|
@ -377,6 +377,8 @@ class ChatController extends AEnvironmentAwareController { |
|
|
|
'messageParameters' => $message->getMessageParameters(), |
|
|
|
'systemMessage' => $message->getMessageType() === 'system' ? $message->getMessageRaw() : '', |
|
|
|
'messageType' => $message->getMessageType(), |
|
|
|
'isReplyable' => $message->getMessageType() !== 'system' && |
|
|
|
($message->getActorType() === 'users' || $message->getActorType() === 'guests'), |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -348,6 +348,8 @@ class RoomController extends AEnvironmentAwareController { |
|
|
|
'messageParameters' => $message->getMessageParameters(), |
|
|
|
'systemMessage' => $message->getMessageType() === 'system' ? $message->getMessageRaw() : '', |
|
|
|
'messageType' => $message->getMessageType(), |
|
|
|
'isReplyable' => $message->getMessageType() !== 'system' && |
|
|
|
($message->getActorType() === 'users' || $message->getActorType() === 'guests'), |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -159,6 +159,13 @@ export default { |
|
|
|
type: Boolean, |
|
|
|
required: true, |
|
|
|
}, |
|
|
|
/** |
|
|
|
* Specifies if the message can be replied to. |
|
|
|
*/ |
|
|
|
isReplyable: { |
|
|
|
type: Boolean, |
|
|
|
required: true, |
|
|
|
}, |
|
|
|
/** |
|
|
|
* The conversation token. |
|
|
|
*/ |
|
|
@ -193,11 +200,6 @@ export default { |
|
|
|
return this.parent && this.$store.getters.message(this.token, this.parent) |
|
|
|
}, |
|
|
|
|
|
|
|
isReplyable() { |
|
|
|
return (this.actorType === 'users' || this.actorType === 'guests') |
|
|
|
&& !this.systemMessage |
|
|
|
}, |
|
|
|
|
|
|
|
isSingleEmoji() { |
|
|
|
const regex = emojiRegex() |
|
|
|
let match |
|
|
|
|
|
@ -92,6 +92,7 @@ class CapabilitiesTest extends TestCase { |
|
|
|
'chat-read-marker', |
|
|
|
'webinary-lobby', |
|
|
|
'start-call-flag', |
|
|
|
'chat-replies', |
|
|
|
], |
|
|
|
'config' => [ |
|
|
|
'chat' => [ |
|
|
@ -148,6 +149,7 @@ class CapabilitiesTest extends TestCase { |
|
|
|
'chat-read-marker', |
|
|
|
'webinary-lobby', |
|
|
|
'start-call-flag', |
|
|
|
'chat-replies', |
|
|
|
], |
|
|
|
'config' => [ |
|
|
|
'chat' => [ |
|
|
|