From 1c13c52acffeac59b0ef5d156a9a5bc36e611619 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?=
 <skjnldsv@protonmail.com>
Date: Wed, 9 Oct 2019 07:53:30 +0200
Subject: [PATCH] Systemtags and external actions update
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
---
 apps/files/src/views/Sidebar.vue                       | 2 +-
 apps/files_sharing/src/components/SharingEntryLink.vue | 9 ++++++++-
 apps/files_sharing/src/services/ExternalLinkActions.js | 4 ++--
 apps/files_sharing/src/views/SharingTab.vue            | 8 ++++++++
 apps/systemtags/src/systemtagsinfoview.js              | 8 ++------
 core/css/systemtags.scss                               | 2 ++
 6 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/apps/files/src/views/Sidebar.vue b/apps/files/src/views/Sidebar.vue
index 9a00df17377..e99389de75f 100644
--- a/apps/files/src/views/Sidebar.vue
+++ b/apps/files/src/views/Sidebar.vue
@@ -113,7 +113,7 @@ export default {
 		 */
 		davPath() {
 			const user = OC.getCurrentUser().uid
-			return OC.linkToRemote(`dav/files/${user}${encodeURIComponent(this.file)}`)
+			return OC.linkToRemote(`dav/files/${user}${this.file}`)
 		},
 
 		/**
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index afeaee06bde..4501d67cbbb 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -247,7 +247,14 @@
 						@update:value="debounceQueueUpdate('note')" />
 				</template>
 
-				<components :is="action" v-for="(action, index) in externalActions" :key="index" />
+				<!-- external sharing via url (social...) -->
+				<ActionLink v-for="({icon, url, name}, index) in externalActions"
+					:key="index"
+					:href="url(shareLink)"
+					:icon="icon"
+					target="_blank">
+					{{ name }}
+				</ActionLink>
 
 				<ActionButton icon="icon-delete" :disabled="saving" @click.prevent="onDelete">
 					{{ t('files_sharing', 'Delete share') }}
diff --git a/apps/files_sharing/src/services/ExternalLinkActions.js b/apps/files_sharing/src/services/ExternalLinkActions.js
index f67a1cb1155..35377d86764 100644
--- a/apps/files_sharing/src/services/ExternalLinkActions.js
+++ b/apps/files_sharing/src/services/ExternalLinkActions.js
@@ -52,11 +52,11 @@ export default class ExternalLinkActions {
 	 * @returns {boolean}
 	 */
 	registerAction(action) {
-		if (typeof action === 'object' && action.render && action.components) {
+		if (typeof action === 'object' && action.icon && action.name && action.url) {
 			this.#state.actions.push(action)
 			return true
 		}
-		console.error(`Invalid action component provided`, action)
+		console.error(`Invalid action provided`, action)
 		return false
 	}
 
diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue
index 4f16f4b2435..216b2e74ffc 100644
--- a/apps/files_sharing/src/views/SharingTab.vue
+++ b/apps/files_sharing/src/views/SharingTab.vue
@@ -69,6 +69,14 @@
 				:id="`${fileInfo.id}`"
 				type="file"
 				:name="fileInfo.name" />
+
+			<!-- additionnal entries, use it with cautious -->
+			<div v-for="(section, index) in sections"
+				:ref="'section-' + index"
+				:key="index"
+				class="sharingTab__additionalContent">
+				<component :is="section($refs['section-'+index], fileInfo)" :file-info="fileInfo" />
+			</div>
 		</template>
 	</Tab>
 </template>
diff --git a/apps/systemtags/src/systemtagsinfoview.js b/apps/systemtags/src/systemtagsinfoview.js
index 548a147591c..2ec1ba0fef4 100644
--- a/apps/systemtags/src/systemtagsinfoview.js
+++ b/apps/systemtags/src/systemtagsinfoview.js
@@ -30,7 +30,7 @@
 
 			_rendered: false,
 
-			className: 'systemTagsInfoView hidden',
+			className: 'systemTagsInfoView',
 
 			/**
 			 * @type OC.SystemTags.SystemTagsInputField
@@ -123,11 +123,7 @@
 							var appliedTags = collection.map(modelToSelection)
 							self._inputView.setData(appliedTags)
 
-							if (appliedTags.length !== 0) {
-								self.show()
-							} else {
-								self.hide()
-							}
+							self.show()
 						}
 					})
 				}
diff --git a/core/css/systemtags.scss b/core/css/systemtags.scss
index bffafe101e3..e2b587fcc79 100644
--- a/core/css/systemtags.scss
+++ b/core/css/systemtags.scss
@@ -69,8 +69,10 @@
 	}
 }
 
+.systemTagsInfoView,
 .systemtags-select2-container {
 	width: 100%;
+	
 	.select2-choices .select2-search-choice.select2-locked .label {
 		opacity: 0.5;
 	}
-- 
GitLab