From 897111404a3f8014b92af4e387a3561a0e8ff547 Mon Sep 17 00:00:00 2001
From: Daniel Calviño Sánchez <danxuliu@gmail.com>
Date: Mon, 13 Jan 2020 12:14:25 +0100
Subject: Add "Password protected by Talk" option to shares
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
---
 .../src/components/SharingEntryLink.vue            | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)

(limited to 'apps/files_sharing/src/components/SharingEntryLink.vue')

diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index cc3c8c764e2..ea0f064a21d 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -195,6 +195,15 @@
 						{{ t('files_sharing', 'Enter a password') }}
 					</ActionInput>
 
+					<!-- password protected by Talk -->
+					<ActionCheckbox v-if="isPasswordProtectedByTalkAvailable"
+						:checked.sync="isPasswordProtectedByTalk"
+						:disabled="saving"
+						class="share-link-password-talk-checkbox"
+						@change="queueUpdate('sendPasswordByTalk')">
+						{{ t('files_sharing', 'Video verification') }}
+					</ActionCheckbox>
+
 					<!-- expiration date -->
 					<ActionCheckbox :checked.sync="hasExpirationDate"
 						:disabled="config.isDefaultExpireDateEnforced || saving"
@@ -418,6 +427,35 @@ export default {
 			},
 		},
 
+		/**
+		 * Is Talk enabled?
+		 * @returns {boolean}
+		 */
+		isTalkEnabled() {
+			return OC.appswebroots['spreed'] !== undefined
+		},
+
+		/**
+		 * Is it possible to protect the password by Talk?
+		 * @returns {boolean}
+		 */
+		isPasswordProtectedByTalkAvailable() {
+			return this.isPasswordProtected && this.isTalkEnabled
+		},
+
+		/**
+		 * Is the current share password protected by Talk?
+		 * @returns {boolean}
+		 */
+		isPasswordProtectedByTalk: {
+			get: function() {
+				return this.share.sendPasswordByTalk
+			},
+			set: async function(enabled) {
+				this.share.sendPasswordByTalk = enabled
+			},
+		},
+
 		/**
 		 * Is the current share an email share ?
 		 * @returns {boolean}
-- 
cgit v1.2.3

