mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Allow users to join their own team's projects
Fix #56 Looked into this for a while, but I think it was simply an oversight in the logic-as-programmed; if you're part of a team, you should be able to just click 'join' on any of that team's projects and be a project-member
This commit is contained in:
@@ -8,7 +8,7 @@ from bugsink.app_settings import get_settings
|
||||
|
||||
from compat.dsn import build_dsn
|
||||
|
||||
from teams.models import TeamMembership, TeamRole
|
||||
from teams.models import TeamMembership
|
||||
|
||||
|
||||
class ProjectRole(models.IntegerChoices):
|
||||
@@ -104,9 +104,8 @@ class Project(models.Model):
|
||||
if user is not None:
|
||||
# take the user's team membership into account
|
||||
try:
|
||||
tm = TeamMembership.objects.get(team=self.team, user=user)
|
||||
if tm.role == TeamRole.ADMIN:
|
||||
return True
|
||||
TeamMembership.objects.get(team=self.team, user=user)
|
||||
return True
|
||||
except TeamMembership.DoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if project.is_joinable or request.user.is_superuser %}
|
||||
{% if ownership_filter == "teams" or project.is_joinable or request.user.is_superuser %}{# ownership_filter check: you can always join your own team's projects, so if you're looking at a list of them... #}
|
||||
<div>
|
||||
<button name="action" value="join:{{ project.id }}" class="font-bold text-slate-500 border-slate-300 pl-4 pr-4 pb-2 pt-2 ml-1 border-2 hover:bg-slate-200 active:ring rounded-md">Join</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user