From e9cdfe40359f67e3c3e0ecb30c243d943f0483bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0est=C3=A1k=20V=C3=ADt?= Date: Tue, 23 Feb 2016 16:13:01 +0100 Subject: [PATCH] Added a disabled feature of potentially better redirection after (un)subscribing. --- app/controllers/Notifications.scala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/Notifications.scala b/app/controllers/Notifications.scala index c5550fb..3e97346 100644 --- a/app/controllers/Notifications.scala +++ b/app/controllers/Notifications.scala @@ -1,5 +1,6 @@ package controllers +import java.net.URLEncoder import java.util.concurrent.atomic.AtomicBoolean import javax.inject.Inject @@ -137,12 +138,15 @@ class Notifications @Inject()( } } + // Redirection to a specific position does not look intuituve now, so it has been disabled for now. + private def redirectToProject(project: String)(implicit th: DefaultRequest) = Redirect(routes.Notifications.listProjects()/*.withFragment("project-" + URLEncoder.encode(project, "utf-8")).absoluteURL()*/) + def watch(project: String) = SecuredAction.async{ implicit req => - for( _ <-notificationService.subscribe(req.identity.loginInfo, project) ) yield Redirect(routes.Notifications.listProjects()) + for( _ <-notificationService.subscribe(req.identity.loginInfo, project) ) yield redirectToProject(project) } - def unwatch(project: String) = SecuredAction.async{implicit req => - for( _ <-notificationService.unsubscribe(req.identity.loginInfo, project) ) yield Redirect(routes.Notifications.listProjects()) + def unwatch(project: String) = SecuredAction.async{ implicit req => + for( _ <-notificationService.unsubscribe(req.identity.loginInfo, project) ) yield redirectToProject(project) } }