Merge pull request #15290 from nextcloud/backport/15259/stable31

[stable31] fix(settings): Change the talk hash when updating attachment location
This commit is contained in:
Joas Schilling
2025-06-04 07:11:50 +02:00
committed by GitHub
6 changed files with 15 additions and 9 deletions

View File

@ -70,7 +70,7 @@ class Config {
public function getUserReadPrivacy(string $userId): int {
return match ((int)$this->config->getUserValue(
$userId,
'spreed', 'read_status_privacy',
'spreed', UserPreference::READ_STATUS_PRIVACY,
(string)Participant::PRIVACY_PUBLIC)) {
Participant::PRIVACY_PUBLIC => Participant::PRIVACY_PUBLIC,
default => Participant::PRIVACY_PRIVATE,
@ -83,7 +83,7 @@ class Config {
public function getUserTypingPrivacy(string $userId): int {
return match ((int)$this->config->getUserValue(
$userId,
'spreed', 'typing_privacy',
'spreed', UserPreference::TYPING_PRIVACY,
(string)Participant::PRIVACY_PUBLIC)) {
Participant::PRIVACY_PUBLIC => Participant::PRIVACY_PUBLIC,
default => Participant::PRIVACY_PRIVATE,
@ -233,7 +233,7 @@ class Config {
return $this->config->getUserValue(
$userId,
'spreed',
'recording_folder',
UserPreference::RECORDING_FOLDER,
$this->getAttachmentFolder($userId) . '/Recording'
);
}
@ -284,7 +284,7 @@ class Config {
public function getAttachmentFolder(string $userId): string {
$defaultAttachmentFolder = $this->config->getAppValue('spreed', 'default_attachment_folder', '/Talk');
return $this->config->getUserValue($userId, 'spreed', 'attachment_folder', $defaultAttachmentFolder);
return $this->config->getUserValue($userId, 'spreed', UserPreference::ATTACHMENT_FOLDER, $defaultAttachmentFolder);
}
/**

View File

@ -66,6 +66,7 @@ use OCA\Talk\Service\RecordingService;
use OCA\Talk\Service\RoomFormatter;
use OCA\Talk\Service\RoomService;
use OCA\Talk\Service\SessionService;
use OCA\Talk\Settings\UserPreference;
use OCA\Talk\Share\Helper\Preloader;
use OCA\Talk\TalkSession;
use OCA\Talk\Webinary;
@ -192,6 +193,7 @@ class RoomController extends AEnvironmentAwareOCSController {
if ($this->userId !== null) {
$values[] = $this->appConfig->getAppValueInt('experiments_users');
$values[] = $this->config->getUserValue($this->userId, 'spreed', UserPreference::ATTACHMENT_FOLDER);
} else {
$values[] = $this->appConfig->getAppValueInt('experiments_guests');
}

View File

@ -19,6 +19,7 @@ use OCA\Talk\Manager;
use OCA\Talk\Participant;
use OCA\Talk\Recording\BackendNotifier;
use OCA\Talk\Room;
use OCA\Talk\Settings\UserPreference;
use OCP\AppFramework\Services\IAppConfig;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\File;
@ -425,7 +426,7 @@ class RecordingService {
'userId' => $owner,
]);
$this->serverConfig->setUserValue($owner, 'spreed', 'attachment_folder', '/');
$this->serverConfig->setUserValue($owner, 'spreed', UserPreference::ATTACHMENT_FOLDER, '/');
}
} catch (NotFoundException $e) {
/** @var Folder */

View File

@ -54,7 +54,7 @@ class BeforePreferenceSetEventListener implements IEventListener {
* @internal Make private/protected once SettingsController route was removed
*/
public function validatePreference(string $userId, string $key, string|int|null $value): bool {
if ($key === 'attachment_folder') {
if ($key === UserPreference::ATTACHMENT_FOLDER) {
return $this->validateAttachmentFolder($userId, $value);
}
@ -70,7 +70,7 @@ class BeforePreferenceSetEventListener implements IEventListener {
|| $key === UserPreference::READ_STATUS_PRIVACY) {
$valid = is_numeric($value) && ((int)$value === Participant::PRIVACY_PRIVATE || (int)$value === Participant::PRIVACY_PUBLIC);
if ($valid && $key === 'read_status_privacy') {
if ($valid && $key === UserPreference::READ_STATUS_PRIVACY) {
$this->participantService->updateReadPrivacyForActor(Attendee::ACTOR_USERS, $userId, (int)$value);
}
return $valid;

View File

@ -9,12 +9,14 @@ declare(strict_types=1);
namespace OCA\Talk\Settings;
class UserPreference {
public const ATTACHMENT_FOLDER = 'attachment_folder';
public const BLUR_VIRTUAL_BACKGROUND = 'blur_virtual_background';
public const CALLS_START_WITHOUT_MEDIA = 'calls_start_without_media';
public const CONVERSATIONS_LIST_STYLE = 'conversations_list_style';
public const PLAY_SOUNDS = 'play_sounds';
public const TYPING_PRIVACY = 'typing_privacy';
public const READ_STATUS_PRIVACY = 'read_status_privacy';
public const RECORDING_FOLDER = 'recording_folder';
public const CONVERSATION_LIST_STYLE_TWO_LINES = 'two-lines';
public const CONVERSATION_LIST_STYLE_COMPACT = 'compact';

View File

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OCA\Talk;
use OC\User\NoUserException;
use OCA\Talk\Settings\UserPreference;
use OCP\App\IAppManager;
use OCP\AppFramework\Services\IInitialState;
use OCP\Files\IRootFolder;
@ -115,7 +116,7 @@ trait TInitialState {
$this->initialState->provideInitialState(
'play_sounds',
$this->serverConfig->getUserValue($user->getUID(), 'spreed', 'play_sounds', 'yes') === 'yes'
$this->serverConfig->getUserValue($user->getUID(), 'spreed', UserPreference::PLAY_SOUNDS, 'yes') === 'yes'
);
$this->initialState->provideInitialState(
@ -150,7 +151,7 @@ trait TInitialState {
$freeSpace = $folder->getFreeSpace();
} catch (NotPermittedException $e) {
$attachmentFolder = '/';
$this->serverConfig->setUserValue($user->getUID(), 'spreed', 'attachment_folder', '/');
$this->serverConfig->setUserValue($user->getUID(), 'spreed', UserPreference::ATTACHMENT_FOLDER, '/');
$freeSpace = $userFolder->getFreeSpace();
}
} catch (NoUserException $e) {