From: Claudio Cambra Date: Tue, 5 Mar 2024 09:15:57 +0000 (+0800) Subject: Properly handle permissions in shareoptionsview X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~7^2~46^2~69 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d9eaeabfe9caa11a2581c5d6d6d52730055638b8;p=nextcloud-desktop.git Properly handle permissions in shareoptionsview Signed-off-by: Claudio Cambra --- diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift index a0f945e7e..f43018f32 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift @@ -47,7 +47,7 @@ class ShareOptionsView: NSView { if share.canEdit { setAllFields(enabled: true) labelTextField.stringValue = share.label - uploadEditPermissionCheckbox.state = share.canEdit ? .on : .off + uploadEditPermissionCheckbox.state = share.shareesCanEdit ? .on : .off hideDownloadCheckbox.state = share.hideDownload ? .on : .off passwordProtectCheckbox.state = share.password.isEmpty ? .off : .on passwordSecureField.isHidden = passwordProtectCheckbox.state == .off @@ -89,6 +89,8 @@ class ShareOptionsView: NSView { @IBAction func save(_ sender: Any) { Task { @MainActor in + guard let controller = controller else { return } + let share = controller.share let password = passwordProtectCheckbox.state == .on ? passwordSecureField.stringValue : "" @@ -100,13 +102,18 @@ class ShareOptionsView: NSView { : "" let label = labelTextField.stringValue let hideDownload = hideDownloadCheckbox.state == .on + let uploadAndEdit = uploadEditPermissionCheckbox.state == .on + let permissions = uploadAndEdit + ? share.permissions | NKShare.PermissionValues.updateShare.rawValue + : share.permissions & ~NKShare.PermissionValues.updateShare.rawValue setAllFields(enabled: false) deleteButton.isEnabled = false saveButton.isEnabled = false - let error = await controller?.save( + let error = await controller.save( password: password, expireDate: expireDate, + permissions: permissions, note: note, label: label, hideDownload: hideDownload