From a459d6607a4f41db0fe29a6617f60b148bdce36a Mon Sep 17 00:00:00 2001 From: Inga Kirschnick Date: Thu, 23 Feb 2023 09:50:09 +0100 Subject: [PATCH] Update Share Link --- app/corpora/routes.py | 5 +---- app/static/js/RessourceDisplays/CorpusDisplay.js | 3 ++- app/templates/corpora/corpus.html.j2 | 14 +++++++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/corpora/routes.py b/app/corpora/routes.py index ab07ca92..9341938a 100644 --- a/app/corpora/routes.py +++ b/app/corpora/routes.py @@ -78,11 +78,8 @@ def follow_corpus(corpus_id, token): options={'require': ['exp', 'iat', 'iss']} ) except jwt.PyJWTError: - abort(403) + abort(410) # permission = payload.get('sub') - expiration = payload.get('exp') - if expiration < int(datetime.utcnow().timestamp()): - abort(403) if not current_user.is_following_corpus(corpus): current_user.follow_corpus(corpus) db.session.commit() diff --git a/app/static/js/RessourceDisplays/CorpusDisplay.js b/app/static/js/RessourceDisplays/CorpusDisplay.js index aab9e470..d42fa20c 100644 --- a/app/static/js/RessourceDisplays/CorpusDisplay.js +++ b/app/static/js/RessourceDisplays/CorpusDisplay.js @@ -123,6 +123,7 @@ class CorpusDisplay extends RessourceDisplay { let generateShareLinkButton = this.displayElement.querySelector('#generate-share-link-button'); let copyShareLinkButton = this.displayElement.querySelector('#copy-share-link-button'); let shareLinkInput = this.displayElement.querySelector('#share-link-input'); + let shareLinkContainer = this.displayElement.querySelector('#share-link-container'); // let permissionSelect = this.displayElement.querySelector('#permission-select'); let expirationDate = this.displayElement.querySelector('#expiration'); @@ -131,7 +132,7 @@ class CorpusDisplay extends RessourceDisplay { // Utils.generateCorpusShareLinkRequest(`${this.corpusId}`, permissionSelect.value, expirationDate.value) Utils.generateCorpusShareLinkRequest(`${this.corpusId}`, expirationDate.value) .then((shareLink) => { - shareLinkInput.parentElement.classList.remove('hide'); + shareLinkContainer.classList.remove('hide'); shareLinkInput.value = shareLink; }); }); diff --git a/app/templates/corpora/corpus.html.j2 b/app/templates/corpora/corpus.html.j2 index 8a4976e2..196faef2 100644 --- a/app/templates/corpora/corpus.html.j2 +++ b/app/templates/corpora/corpus.html.j2 @@ -119,9 +119,17 @@
Generate Share Link -
- - Copy +
+