Skip to content

Commit

Permalink
[projects] Draft to assign permissions to project owner in case they …
Browse files Browse the repository at this point in the history
…want to administrate their project from another site
  • Loading branch information
glibersat committed Feb 6, 2025
1 parent 65ef613 commit ee6b1c8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions recoco/apps/crm/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,7 @@ def project_site_handover(request, project_id):
is_origin=False,
status="DRAFT",
)

onboarding_utils.notify_new_project(
site=site, project=project, owner=project.owner
)
Expand Down
2 changes: 1 addition & 1 deletion recoco/apps/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def origin(self):

def moderated(self):
"""Filter out sites where this project is not yet validated"""
return self.exclude(status="DRAFT")
return self.exclude(status__in=["DRAFT", "REJECTED"])

def to_moderate(self):
"""List only sites where this project needs moderation"""
Expand Down
3 changes: 3 additions & 0 deletions recoco/apps/projects/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ def project_moderation_accept(request, project_pk):
# Invite her to fill in a new form
# Send an email to the project owner

# TODO: We should iterate over the collaborator list to assign them the
# project permission for this site (permisssion = COLLABORATOR)

params = {
"project": digests.make_project_digest(project, owner),
"site": digests.make_site_digest(
Expand Down
2 changes: 1 addition & 1 deletion recoco/apps/projects/views/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def fetch_the_site_project_statuses_for_user(site, user):
"""
project_statuses = models.UserProjectStatus.objects.filter(
user=user, project__deleted=None, project__sites=site
)
).exclude(project__projectsites__status__in=["DRAFT", "REJECTED"])

# create missing user project status
create_missing_user_project_statuses(site, user, project_statuses)
Expand Down

0 comments on commit ee6b1c8

Please sign in to comment.