Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-11-25 20:05:16 +0300
committerJoas Schilling <coding@schilljs.com>2019-12-04 10:37:26 +0300
commit3496c7faaa8ffc94a2a090d58d355aa35f5fe0d3 (patch)
treec19ac1169aa010974d0600fa5044ed29dfbf7d36
parentff7efea822e95e8927929140995ed5031bec5d80 (diff)
Add a flag to messages if they can be replied to
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--docs/capabilities.md4
-rw-r--r--docs/chat.md1
-rw-r--r--lib/Capabilities.php1
-rw-r--r--lib/Controller/ChatController.php2
-rw-r--r--lib/Controller/RoomController.php2
-rw-r--r--src/components/MessagesList/MessagesGroup/Message/Message.vue12
-rw-r--r--tests/php/CapabilitiesTest.php2
7 files changed, 19 insertions, 5 deletions
diff --git a/docs/capabilities.md b/docs/capabilities.md
index 4c253fcea..ae4904fc2 100644
--- a/docs/capabilities.md
+++ b/docs/capabilities.md
@@ -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.
diff --git a/docs/chat.md b/docs/chat.md
index d0e36778c..ab1983dfb 100644
--- a/docs/chat.md
+++ b/docs/chat.md
@@ -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))
diff --git a/lib/Capabilities.php b/lib/Capabilities.php
index a2b96d10e..f338b21cc 100644
--- a/lib/Capabilities.php
+++ b/lib/Capabilities.php
@@ -81,6 +81,7 @@ class Capabilities implements IPublicCapability {
'chat-read-marker',
'webinary-lobby',
'start-call-flag',
+ 'chat-replies',
],
'config' => [
'chat' => [
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index 7e05cc2e5..7e58a9c28 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -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'),
];
}
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index 2e7cb35b8..18bd34fd7 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -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'),
];
}
diff --git a/src/components/MessagesList/MessagesGroup/Message/Message.vue b/src/components/MessagesList/MessagesGroup/Message/Message.vue
index 5b5178ade..c3deccc91 100644
--- a/src/components/MessagesList/MessagesGroup/Message/Message.vue
+++ b/src/components/MessagesList/MessagesGroup/Message/Message.vue
@@ -160,6 +160,13 @@ export default {
required: true,
},
/**
+ * Specifies if the message can be replied to.
+ */
+ isReplyable: {
+ type: Boolean,
+ required: true,
+ },
+ /**
* The conversation token.
*/
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
diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php
index a0e29b76a..63bea52e8 100644
--- a/tests/php/CapabilitiesTest.php
+++ b/tests/php/CapabilitiesTest.php
@@ -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' => [