From 0a45e1bb65c79b2fc58e94f9b0423b1053d11038 Mon Sep 17 00:00:00 2001 From: Inga Kirschnick Date: Thu, 21 Dec 2023 12:48:50 +0100 Subject: [PATCH] Bug fixes --- app/corpora/routes.py | 16 ++++++++-------- app/templates/_base/scripts.html.j2 | 10 ++++++---- app/templates/corpora/public_corpus.html.j2 | 8 ++++---- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/corpora/routes.py b/app/corpora/routes.py index 2db52331..66e6c2df 100644 --- a/app/corpora/routes.py +++ b/app/corpora/routes.py @@ -97,14 +97,14 @@ def analysis(corpus_id): ) -# @bp.route('//follow/') -# def follow_corpus(corpus_id, token): -# corpus = Corpus.query.get_or_404(corpus_id) -# if current_user.follow_corpus_by_token(token): -# db.session.commit() -# flash(f'You are following "{corpus.title}" now', category='corpus') -# return redirect(url_for('corpora.corpus', corpus_id=corpus_id)) -# abort(403) +@bp.route('//follow/') +def follow_corpus(corpus_id, token): + corpus = Corpus.query.get_or_404(corpus_id) + if current_user.follow_corpus_by_token(token): + db.session.commit() + flash(f'You are following "{corpus.title}" now', category='corpus') + return redirect(url_for('corpora.corpus', corpus_id=corpus_id)) + abort(403) @bp.route('/import', methods=['GET', 'POST']) diff --git a/app/templates/_base/scripts.html.j2 b/app/templates/_base/scripts.html.j2 index 91d44ada..663693f6 100644 --- a/app/templates/_base/scripts.html.j2 +++ b/app/templates/_base/scripts.html.j2 @@ -135,9 +135,11 @@ diff --git a/app/templates/corpora/public_corpus.html.j2 b/app/templates/corpora/public_corpus.html.j2 index 5c6556c8..663cf49b 100644 --- a/app/templates/corpora/public_corpus.html.j2 +++ b/app/templates/corpora/public_corpus.html.j2 @@ -273,7 +273,7 @@ publicCorpusFollowerList.add( {% if cfr.has_permission('MANAGE_FILES') %} let followerBuildRequest = document.querySelector('#follower-build-request'); followerBuildRequest.addEventListener('click', () => { - requests.corpora.entity.build({{ corpus.hashid|tojson }}) + nopaque.requests.corpora.entity.build({{ corpus.hashid|tojson }}) .then((response) => { window.location.reload(); }); @@ -285,7 +285,7 @@ followerBuildRequest.addEventListener('click', () => { {% if current_user.is_following_corpus(corpus) %} let unfollowRequestElement = document.querySelector('.action-button[data-action="unfollow-request"]'); unfollowRequestElement.addEventListener('click', () => { - requests.corpora.entity.followers.entity.delete({{ corpus.hashid|tojson }}, {{ current_user.hashid|tojson }}) + nopaque.requests.corpora.entity.followers.entity.delete({{ corpus.hashid|tojson }}, {{ current_user.hashid|tojson }}) .then((response) => { window.location.reload(); }); @@ -335,7 +335,7 @@ M.Modal.init( inviteUserModalInviteButtonElement.addEventListener('click', (event) => { let usernames = inviteUserModalSearch.chipsData.map((chipData) => chipData.tag); - requests.corpora.entity.followers.add({{ corpus.hashid|tojson }}, usernames) + nopaque.requests.corpora.entity.followers.add({{ corpus.hashid|tojson }}, usernames) .then((response) => { window.location.reload(); }); @@ -383,7 +383,7 @@ M.Modal.init( shareLinkModalCreateButtonElement.addEventListener('click', (event) => { let role = shareLinkModalCorpusFollowerRoleSelectElement.value; let expiration = shareLinkModalExpirationDateDatepickerElement.value - requests.corpora.entity.generateShareLink({{ corpus.hashid|tojson }}, role, expiration) + nopaque.requests.corpora.entity.generateShareLink({{ corpus.hashid|tojson }}, role, expiration) .then((response) => { response.json() .then((json) => {