Flash message to confirm invitation accepted and user has been

added to service.
This commit is contained in:
Adam Shimali
2016-03-08 08:18:41 +00:00
parent 614e454186
commit 9bc5d08d52
4 changed files with 17 additions and 6 deletions

View File

@@ -1,4 +1,10 @@
from flask import (abort, render_template, session)
from flask import (
abort,
render_template,
session,
flash
)
from flask_login import login_required
from app.main import main
from app.main.dao.services_dao import get_service_by_id
@@ -6,8 +12,6 @@ from app.main.dao import templates_dao
from notifications_python_client.errors import HTTPError
from app import job_api_client
from app.utils import user_has_permissions
@main.route("/services/<service_id>/dashboard")
@login_required
@@ -24,6 +28,12 @@ def service_dashboard(service_id):
service = get_service_by_id(service_id)
session['service_name'] = service['data']['name']
session['service_id'] = service['data']['id']
if session.get('invited_user'):
session.pop('invited_user', None)
service_name = service['data']['name']
message = 'You have sucessfully accepted your invitation and been added to {}'.format(service_name)
flash(message, 'default_with_tick')
except HTTPError as e:
if e.status_code == 404:
abort(404)