return ok();
}
public static Result toggle(Long projectId, String notificationType) {
EventType notiType = EventType.valueOf(notificationType);
Project project = Project.find.byId(projectId);
User user = UserApp.currentUser();
if(project == null) {
return notFound(ErrorViews.NotFound.render("error.notfound.project"));
}
if(!AccessControl.isAllowed(user, project.asResource(), Operation.READ)) {
return forbidden(ErrorViews.Forbidden.render("error.forbidden", project));
}
if(!Watch.isWatching(user, project.asResource())) {
return badRequest(Messages.get("error.notfound.watch"));
}
UserProjectNotification upn = UserProjectNotification.findOne(user, project, notiType);
if(upn == null) { // make the EventType OFF, because default is ON.