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
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-12-08 18:25:52 +0300
committerJoas Schilling <coding@schilljs.com>2020-12-10 13:47:05 +0300
commit50da7dac82b1171a5a8343b1d27642af3cebb675 (patch)
treeff639b692411f6f2325b02ff7a3779af31fecfe2 /lib
parent076f4261596f293f7c53dba86329ba0e354834a0 (diff)
Add a capability for the chat-read-status and the user setting
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Capabilities.php4
-rw-r--r--lib/Config.php7
-rw-r--r--lib/Controller/RoomController.php2
-rw-r--r--lib/Service/ParticipantService.php2
-rw-r--r--lib/TInitialState.php2
5 files changed, 13 insertions, 4 deletions
diff --git a/lib/Capabilities.php b/lib/Capabilities.php
index 7063e8d71..8dd4cca51 100644
--- a/lib/Capabilities.php
+++ b/lib/Capabilities.php
@@ -81,6 +81,7 @@ class Capabilities implements IPublicCapability {
'circles-support',
'force-mute',
'sip-support',
+ 'chat-read-status',
],
'config' => [
'attachments' => [
@@ -88,6 +89,7 @@ class Capabilities implements IPublicCapability {
],
'chat' => [
'max-length' => ChatManager::MAX_CHAT_LENGTH,
+ 'read-privacy' => Participant::PRIVACY_PUBLIC,
],
'conversations' => [],
'previews' => [
@@ -98,11 +100,11 @@ class Capabilities implements IPublicCapability {
if ($user instanceof IUser) {
$capabilities['config']['attachments']['folder'] = $this->talkConfig->getAttachmentFolder($user->getUID());
+ $capabilities['config']['chat']['read-privacy'] = $this->talkConfig->getUserReadPrivacy($user->getUID());
}
$capabilities['config']['conversations']['can-create'] = $user instanceof IUser && !$this->talkConfig->isNotAllowedToCreateConversations($user);
-
if ($this->serverConfig->getAppValue('spreed', 'has_reference_id', 'no') === 'yes') {
$capabilities['features'][] = 'chat-reference-id';
}
diff --git a/lib/Config.php b/lib/Config.php
index 16255dbfb..a7163ef9c 100644
--- a/lib/Config.php
+++ b/lib/Config.php
@@ -65,6 +65,13 @@ class Config {
return \is_array($groups) ? $groups : [];
}
+ public function getUserReadPrivacy(string $userId): int {
+ return (int) $this->config->getUserValue(
+ $userId,
+ 'spreed', 'read_status_privacy',
+ (string) Participant::PRIVACY_PUBLIC);
+ }
+
/**
* @return string[]
*/
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index 2d7a050e3..06d7e6334 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -199,7 +199,7 @@ class RoomController extends AEnvironmentAwareController {
}
$rooms = $this->manager->getRoomsForUser($this->userId, true);
- $readPrivacy = (int) $this->config->getUserValue($this->userId, 'spreed', 'read_status_privacy', (string) Participant::PRIVACY_PUBLIC);
+ $readPrivacy = $this->talkConfig->getUserReadPrivacy($this->userId);
if ($readPrivacy === Participant::PRIVACY_PUBLIC) {
$roomIds = array_map(static function (Room $room) {
return $room->getId();
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php
index af731d060..d5d59827d 100644
--- a/lib/Service/ParticipantService.php
+++ b/lib/Service/ParticipantService.php
@@ -245,7 +245,7 @@ class ParticipantService {
foreach ($participants as $participant) {
$readPrivacy = Participant::PRIVACY_PUBLIC;
if ($participant['actorType'] === Attendee::ACTOR_USERS) {
- $readPrivacy = (int) $this->serverConfig->getUserValue($participant['actorId'], 'spreed', 'read_status_privacy', (string) Participant::PRIVACY_PUBLIC);
+ $readPrivacy = $this->talkConfig->getUserReadPrivacy($participant['actorId']);
}
$attendee = new Attendee();
diff --git a/lib/TInitialState.php b/lib/TInitialState.php
index 272d841b0..b07046267 100644
--- a/lib/TInitialState.php
+++ b/lib/TInitialState.php
@@ -89,7 +89,7 @@ trait TInitialState {
$this->initialStateService->provideInitialState(
'talk', 'read_status_privacy',
- (int) $this->serverConfig->getUserValue($user->getUID(), 'spreed', 'read_status_privacy', (string) Participant::PRIVACY_PUBLIC)
+ $this->talkConfig->getUserReadPrivacy($user->getUID())
);
$attachmentFolder = $this->talkConfig->getAttachmentFolder($user->getUID());