From 444c9b6744f00a0fb8ac31cf0c827c150719bc68 Mon Sep 17 00:00:00 2001
From: "John Molakvoæ (skjnldsv)" <skjnldsv@protonmail.com>
Date: Wed, 13 Nov 2019 15:43:11 +0100
Subject: Add settings front and split sharing entry config
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_sharing/src/components/SharingEntry.vue | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

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

diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue
index 09d09d607fe..cde7d2ed2b1 100644
--- a/apps/files_sharing/src/components/SharingEntry.vue
+++ b/apps/files_sharing/src/components/SharingEntry.vue
@@ -213,6 +213,28 @@ export default {
 			set: function(checked) {
 				this.updatePermissions(this.canEdit, checked)
 			}
+		},
+
+		/**
+		 * Does the current share have an expiration date
+		 * @returns {boolean}
+		 */
+		hasExpirationDate: {
+			get: function() {
+				return this.config.isDefaultInternalExpireDateEnforced || !!this.share.expireDate
+			},
+			set: function(enabled) {
+				this.share.expireDate = enabled
+					? this.config.defaultInternalExpirationDateString !== ''
+						? this.config.defaultInternalExpirationDateString
+						: moment().format('YYYY-MM-DD')
+					: ''
+			}
+		},
+
+		dateMaxEnforced() {
+			return this.config.isDefaultInternalExpireDateEnforced
+				&& moment().add(1 + this.config.defaultInternalExpireDate, 'days')
 		}
 
 	},
-- 
cgit v1.2.3

