Commit a68519e3 authored by Olga Brani's avatar Olga Brani
Browse files

Merge branch 'latest-quota' of https://code.grnet.gr/git/synnefo into latest-quota

parents 813d52b6 1452f8c4
......@@ -178,6 +178,7 @@ UNKNOWN_IDENTIFIER = 'Unknown identifier.'
PENDING_MEMBERSHIP_LEAVE = 'Your request is pending moderation by the Project owner.'
USER_JOINED_PROJECT = '%(realname)s has joined the Project.'
USER_LEFT_PROJECT = '%(realname)s has left the Project.'
USER_JOIN_REQUEST_SUBMITED = 'Join request submitted.'
# Auth providers messages
AUTH_PROVIDER_NOT_ACTIVE = "'%(provider)s' is disabled."
......
......@@ -1123,7 +1123,7 @@ class ProjectApplicationManager(ForUpdateManager):
Return projects accessed by specified user.
"""
return self.filter(Q(owner=user) | Q(applicant=user) | \
Q(project__projectmembership__person=user))
Q(project__projectmembership__person=user)).distinct()
def search_by_name(self, *search_strings):
q = Q()
......
......@@ -244,6 +244,7 @@ class UserProjectApplicationsTable(UserTable):
def member_action_extra_context(membership, table, col):
context = []
urls, actions, prompts, confirms = [], [], [], []
if membership.state == ProjectMembership.REQUESTED:
urls = ['astakos.im.views.project_reject_member',
......
......@@ -1092,6 +1092,7 @@ def project_update(request, application_id):
@require_http_methods(["GET", "POST"])
@signed_terms_required
@login_required
@transaction.commit_on_success
def project_detail(request, application_id):
addmembers_form = AddProjectMembersForm()
if request.method == 'POST':
......@@ -1188,12 +1189,15 @@ def project_search(request):
def project_join(request, application_id):
next = request.GET.get('next')
if not next:
next = reverse('astakos.im.views.project_list')
next = reverse('astakos.im.views.project_detail',
args=(application_id,))
rollback = False
try:
application_id = int(application_id)
join_project(application_id, request.user)
# TODO: distinct messages for request/auto accept ???
messages.success(request, _(astakos_messages.USER_JOIN_REQUEST_SUBMITED))
except (IOError, PermissionDenied), e:
messages.error(request, e)
except BaseException, e:
......@@ -1236,7 +1240,7 @@ def project_leave(request, application_id):
next = restrict_next(next, domain=COOKIE_DOMAIN)
return redirect(next)
@require_http_methods(["GET"])
@require_http_methods(["POST"])
@signed_terms_required
@login_required
@transaction.commit_manually
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment