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
2 changes: 2 additions & 0 deletions docs/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,5 @@
* `config => call => grid-limit-enforced` (local) - Whether the limit is hard enforced for all participants
* `config => feature-hints => current` (local) - The current feature hint count that should be sent to the app config to hide all current feature hints
* `config => feature-hints => hidden` (local) - Number of the last hint the administration has hidden via the app config
* `config => conversations => sort-order` (local) - User selected sort order for conversations (`activity` or `alphabetical`)
* `config => conversations => group-mode` (local) - User selected grouping mode for conversations (`none`, `group-first` or `private-first`)
13 changes: 13 additions & 0 deletions docs/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@
* `two-lines` Normal (default) - two-line elements (with display name and last message)
* `compact` Compact - one-line elements (with display name)

### Conversations sort options
Required capability: `config => conversations => sort-order`

* `activity` (default) - Conversations are ordered by last chat or call activity
* `alphabetical` - Conversations are ordered by the display name

### Conversations group mode
Required capability: `config => conversations => group-mode`

* `none` (default) - Conversations are not grouped by type
* `group-first` - Conversations are grouped and group (and public) conversations shown first
* `private-first` - Conversations are grouped and private (one-to-one) conversations shown first

### Conversation attributes
Required capability: `conversation-presets`

Expand Down
4 changes: 4 additions & 0 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ class Capabilities implements IPublicCapability {
'conversations' => [
'can-create',
'list-style',
'sort-order',
'group-mode',
'description-length',
],
'federation' => [
Expand Down Expand Up @@ -294,6 +296,8 @@ public function getCapabilities(): array {
'can-create' => $user instanceof IUser && !$this->talkConfig->isNotAllowedToCreateConversations($user),
'force-passwords' => $this->talkConfig->isPasswordEnforced(),
'list-style' => $this->talkConfig->getConversationsListStyle($user?->getUID()),
'sort-order' => $this->talkConfig->getConversationsSortOrder($user?->getUID()),
'group-mode' => $this->talkConfig->getConversationsGroupMode($user?->getUID()),
'description-length' => Room::DESCRIPTION_MAXIMUM_LENGTH,
'retention-event' => max(0, $this->appConfig->getAppValueInt('retention_event_rooms', 28)),
'retention-phone' => max(0, $this->appConfig->getAppValueInt('retention_phone_rooms', 7)),
Expand Down
48 changes: 48 additions & 0 deletions lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,54 @@ public function getChatStyle(?string $userId): string {
return UserPreference::CHAT_STYLE_SPLIT;
}

/**
* User setting for conversations sort order
*
* @param ?string $userId
* @return UserPreference::CONVERSATIONS_SORT_ORDER_*
*/
public function getConversationsSortOrder(?string $userId): string {
if ($userId !== null) {
$userSetting = $this->config->getUserValue(
$userId,
'spreed',
UserPreference::CONVERSATIONS_SORT_ORDER,
);

if (in_array($userSetting, [UserPreference::CONVERSATIONS_SORT_ORDER_ACTIVITY, UserPreference::CONVERSATIONS_SORT_ORDER_ALPHABETICAL], true)) {
return $userSetting;
}
}

return UserPreference::CONVERSATIONS_SORT_ORDER_ACTIVITY;
}

/**
* User setting for conversations group mode
*
* @param ?string $userId
* @return UserPreference::CONVERSATIONS_GROUP_MODE_*
*/
public function getConversationsGroupMode(?string $userId): string {
if ($userId !== null) {
$userSetting = $this->config->getUserValue(
$userId,
'spreed',
UserPreference::CONVERSATIONS_GROUP_MODE,
);

if (in_array($userSetting, [
UserPreference::CONVERSATIONS_GROUP_MODE_NONE,
UserPreference::CONVERSATIONS_GROUP_MODE_GROUP_FIRST,
UserPreference::CONVERSATIONS_GROUP_MODE_PRIVATE_FIRST,
], true)) {
return $userSetting;
}
}

return UserPreference::CONVERSATIONS_GROUP_MODE_NONE;
}

/**
* User setting falling back to admin defined app config
*/
Expand Down
4 changes: 4 additions & 0 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,10 @@
* retention-phone: non-negative-int,
* // Retention period for instant meetings in seconds, `0` means no retention
* retention-instant-meetings: non-negative-int,
* // User selected sort order for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-sort-options))
* sort-order: 'activity'|'alphabetical',
* // User selected grouping mode for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-group-mode))
* group-mode: 'none'|'group-first'|'private-first',
* },
* federation: array{
* // Whether federation is enabled
Expand Down
10 changes: 10 additions & 0 deletions lib/Settings/BeforePreferenceSetEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ public function validatePreference(string $userId, string $key, string|int|null
if ($key === UserPreference::CHAT_STYLE) {
return $value === UserPreference::CHAT_STYLE_SPLIT || $value === UserPreference::CHAT_STYLE_UNIFIED;
}
if ($key === UserPreference::CONVERSATIONS_SORT_ORDER) {
return $value === UserPreference::CONVERSATIONS_SORT_ORDER_ACTIVITY || $value === UserPreference::CONVERSATIONS_SORT_ORDER_ALPHABETICAL;
}
if ($key === UserPreference::CONVERSATIONS_GROUP_MODE) {
return in_array($value, [
UserPreference::CONVERSATIONS_GROUP_MODE_NONE,
UserPreference::CONVERSATIONS_GROUP_MODE_GROUP_FIRST,
UserPreference::CONVERSATIONS_GROUP_MODE_PRIVATE_FIRST,
], true);
}

if ($key === UserPreference::LIVE_TRANSCRIPTION_TARGET_LANGUAGE_ID) {
// Accept any value, as it will be used for both local and federated
Expand Down
9 changes: 9 additions & 0 deletions lib/Settings/UserPreference.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@ class UserPreference {
public const CHAT_STYLE_SPLIT = 'split';
public const CHAT_STYLE_UNIFIED = 'unified';

public const CONVERSATIONS_SORT_ORDER = 'conversations_sort_order';
public const CONVERSATIONS_SORT_ORDER_ACTIVITY = 'activity';
public const CONVERSATIONS_SORT_ORDER_ALPHABETICAL = 'alphabetical';

public const CONVERSATIONS_GROUP_MODE = 'conversations_group_mode';
public const CONVERSATIONS_GROUP_MODE_NONE = 'none';
public const CONVERSATIONS_GROUP_MODE_GROUP_FIRST = 'group-first';
public const CONVERSATIONS_GROUP_MODE_PRIVATE_FIRST = 'private-first';

public const LIVE_TRANSCRIPTION_TARGET_LANGUAGE_ID = 'live_transcription_target_language_id';
}
21 changes: 20 additions & 1 deletion openapi-administration.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,9 @@
"description-length",
"retention-event",
"retention-phone",
"retention-instant-meetings"
"retention-instant-meetings",
"sort-order",
"group-mode"
],
"properties": {
"can-create": {
Expand Down Expand Up @@ -390,6 +392,23 @@
"format": "int64",
"description": "Retention period for instant meetings in seconds, `0` means no retention",
"minimum": 0
},
"sort-order": {
"type": "string",
"enum": [
"activity",
"alphabetical"
],
"description": "User selected sort order for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-sort-options))"
},
"group-mode": {
"type": "string",
"enum": [
"none",
"group-first",
"private-first"
],
"description": "User selected grouping mode for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-group-mode))"
}
}
},
Expand Down
21 changes: 20 additions & 1 deletion openapi-backend-recording.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@
"description-length",
"retention-event",
"retention-phone",
"retention-instant-meetings"
"retention-instant-meetings",
"sort-order",
"group-mode"
],
"properties": {
"can-create": {
Expand Down Expand Up @@ -313,6 +315,23 @@
"format": "int64",
"description": "Retention period for instant meetings in seconds, `0` means no retention",
"minimum": 0
},
"sort-order": {
"type": "string",
"enum": [
"activity",
"alphabetical"
],
"description": "User selected sort order for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-sort-options))"
},
"group-mode": {
"type": "string",
"enum": [
"none",
"group-first",
"private-first"
],
"description": "User selected grouping mode for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-group-mode))"
}
}
},
Expand Down
21 changes: 20 additions & 1 deletion openapi-backend-signaling.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@
"description-length",
"retention-event",
"retention-phone",
"retention-instant-meetings"
"retention-instant-meetings",
"sort-order",
"group-mode"
],
"properties": {
"can-create": {
Expand Down Expand Up @@ -313,6 +315,23 @@
"format": "int64",
"description": "Retention period for instant meetings in seconds, `0` means no retention",
"minimum": 0
},
"sort-order": {
"type": "string",
"enum": [
"activity",
"alphabetical"
],
"description": "User selected sort order for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-sort-options))"
},
"group-mode": {
"type": "string",
"enum": [
"none",
"group-first",
"private-first"
],
"description": "User selected grouping mode for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-group-mode))"
}
}
},
Expand Down
21 changes: 20 additions & 1 deletion openapi-backend-sipbridge.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@
"description-length",
"retention-event",
"retention-phone",
"retention-instant-meetings"
"retention-instant-meetings",
"sort-order",
"group-mode"
],
"properties": {
"can-create": {
Expand Down Expand Up @@ -364,6 +366,23 @@
"format": "int64",
"description": "Retention period for instant meetings in seconds, `0` means no retention",
"minimum": 0
},
"sort-order": {
"type": "string",
"enum": [
"activity",
"alphabetical"
],
"description": "User selected sort order for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-sort-options))"
},
"group-mode": {
"type": "string",
"enum": [
"none",
"group-first",
"private-first"
],
"description": "User selected grouping mode for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-group-mode))"
}
}
},
Expand Down
21 changes: 20 additions & 1 deletion openapi-bots.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@
"description-length",
"retention-event",
"retention-phone",
"retention-instant-meetings"
"retention-instant-meetings",
"sort-order",
"group-mode"
],
"properties": {
"can-create": {
Expand Down Expand Up @@ -313,6 +315,23 @@
"format": "int64",
"description": "Retention period for instant meetings in seconds, `0` means no retention",
"minimum": 0
},
"sort-order": {
"type": "string",
"enum": [
"activity",
"alphabetical"
],
"description": "User selected sort order for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-sort-options))"
},
"group-mode": {
"type": "string",
"enum": [
"none",
"group-first",
"private-first"
],
"description": "User selected grouping mode for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-group-mode))"
}
}
},
Expand Down
21 changes: 20 additions & 1 deletion openapi-federation.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@
"description-length",
"retention-event",
"retention-phone",
"retention-instant-meetings"
"retention-instant-meetings",
"sort-order",
"group-mode"
],
"properties": {
"can-create": {
Expand Down Expand Up @@ -364,6 +366,23 @@
"format": "int64",
"description": "Retention period for instant meetings in seconds, `0` means no retention",
"minimum": 0
},
"sort-order": {
"type": "string",
"enum": [
"activity",
"alphabetical"
],
"description": "User selected sort order for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-sort-options))"
},
"group-mode": {
"type": "string",
"enum": [
"none",
"group-first",
"private-first"
],
"description": "User selected grouping mode for conversations (see [constants list](https://nextcloud-talk.readthedocs.io/en/latest/constants#conversations-group-mode))"
}
}
},
Expand Down
Loading
Loading