Skip to content

Commit

Permalink
Improvements after code review
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos committed May 5, 2023
1 parent 744ec4c commit 7e9a768
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/constants.md
Expand Up @@ -77,8 +77,8 @@
* `1` Read status is private

### Participant typing privacy
* `0` Make visible the typing status
* `1` Hide the typing status
* `0` Typing status is public
* `1` Typing status is private

### Attendee types
* `users` - Logged-in users
Expand Down
6 changes: 1 addition & 5 deletions lib/Controller/SettingsController.php
Expand Up @@ -114,11 +114,7 @@ protected function validateUserSetting(string $setting, $value): bool {
return false;
}

if ($setting === 'typing_privacy') {
return $value === '1' || $value === '0';
}

if ($setting === 'read_status_privacy') {
if ($setting === 'typing_privacy' || $setting === 'read_status_privacy') {
return (int) $value === Participant::PRIVACY_PUBLIC ||
(int) $value === Participant::PRIVACY_PRIVATE;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/TInitialState.php
Expand Up @@ -197,7 +197,7 @@ protected function publishInitialStateForGuest(): void {

$this->initialState->provideInitialState(
'typing_privacy',
'0'
Participant::PRIVACY_PUBLIC
);

$this->initialState->provideInitialState(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/chat-2/typing-privacy.feature
Expand Up @@ -2,10 +2,10 @@ Feature: chat-2/typing-privacy
Background:
Given user "participant1" exists
Scenario: User toggles the typing privacy
# Hide
# Private
When user "participant1" sets setting "typing_privacy" to "1" with 200 (v1)
Then user "participant1" has capability "spreed=>config=>chat=>typing-privacy" set to "1"

# Visible
# Public
When user "participant1" sets setting "typing_privacy" to "0" with 200 (v1)
Then user "participant1" has capability "spreed=>config=>chat=>typing-privacy" set to "0"

0 comments on commit 7e9a768

Please sign in to comment.