From 4cb16852240a7a1a96d694feebf38717ed8fe535 Mon Sep 17 00:00:00 2001 From: dasGoogle Date: Wed, 29 Jan 2020 10:57:36 +0100 Subject: [PATCH 1/2] change click behavior of invitation btn --- controllers/teams.js | 3 ++- static/scripts/teamOverview.js | 18 +----------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/controllers/teams.js b/controllers/teams.js index 5c6d9dc627..ce608d2fe8 100644 --- a/controllers/teams.js +++ b/controllers/teams.js @@ -289,6 +289,7 @@ router.get('/', async (req, res, next) => { team.background = team.color; team.memberAmount = team.userIds.length; team.id = team._id; + team.url = `/teams/invitation/accept/${team._id}`; return team; }); @@ -1199,7 +1200,7 @@ router.get('/invitation/accept/:teamId', async (req, res, next) => { der Nutzer hat nicht die Rechte oder ist schon Mitglied des Teams. `, err, ); - res.redirect('/teams/'); + res.redirect(`/teams/${req.params.teamId}`); }); }); diff --git a/static/scripts/teamOverview.js b/static/scripts/teamOverview.js index a992c6d200..b6a13db5b7 100644 --- a/static/scripts/teamOverview.js +++ b/static/scripts/teamOverview.js @@ -1,21 +1,5 @@ +import { softNavigate } from './helpers/navigation'; $(document).ready(() => { - $('.section-teamInvitations a').click(function handler(e) { - e.stopPropagation(); - e.preventDefault(); - - const id = $(this).parents('.sc-card-wrapper').data('id'); - - $.ajax({ - url: `/teams/invitation/accept/${id}`, - method: 'GET', - }).done(() => { - $.showNotification('Einladung erfolgreich angenommen', 'success', true); - location.reload(); - }).fail(() => { - $.showNotification('Problem beim Akzeptieren der Einladung', 'danger', true); - }); - }); - $('.btn-member').on('click', function (e) { e.stopPropagation(); e.preventDefault(); From e59b35a885ad94c8397a0f9fc449b6a16269b807 Mon Sep 17 00:00:00 2001 From: dasGoogle Date: Wed, 29 Jan 2020 11:17:11 +0100 Subject: [PATCH 2/2] remove unneccessary dependency --- static/scripts/teamOverview.js | 1 - 1 file changed, 1 deletion(-) diff --git a/static/scripts/teamOverview.js b/static/scripts/teamOverview.js index b6a13db5b7..b78e6c130f 100644 --- a/static/scripts/teamOverview.js +++ b/static/scripts/teamOverview.js @@ -1,4 +1,3 @@ -import { softNavigate } from './helpers/navigation'; $(document).ready(() => { $('.btn-member').on('click', function (e) { e.stopPropagation();