mirror of
https://github.com/bugsink/bugsink.git
synced 2026-05-04 22:10:18 -05:00
Project-list button-visibility fixed for auth
This commit is contained in:
@@ -22,7 +22,7 @@ class Migration(migrations.Migration):
|
||||
('alert_on_new_issue', models.BooleanField(default=True)),
|
||||
('alert_on_regression', models.BooleanField(default=True)),
|
||||
('alert_on_unmute', models.BooleanField(default=True)),
|
||||
('visibility', models.IntegerField(choices=[(1, 'Joinable'), (10, 'Visible'), (99, 'Team Members')], default=99)),
|
||||
('visibility', models.IntegerField(choices=[(1, 'Joinable'), (10, 'Discoverable'), (99, 'Team Members')], default=99)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
|
||||
+4
-1
@@ -19,7 +19,7 @@ class ProjectRole(models.IntegerChoices):
|
||||
class ProjectVisibility(models.IntegerChoices):
|
||||
# PUBLIC = 0 # anyone can see the project and its members; not sure if I want this or always require click-in
|
||||
JOINABLE = 1 # anyone can join
|
||||
VISIBLE = 10 # the project is visible, you can request to join(?), but this needs to be approved
|
||||
DISCOVERABLE = 10 # the project's existance is visible, you can request to join(?), but this needs to be approved
|
||||
TEAM_MEMBERS = 99 # the project is only visible to team-members (and for some(?) things they need to click "join")
|
||||
|
||||
|
||||
@@ -107,6 +107,9 @@ class Project(models.Model):
|
||||
|
||||
return self.visibility <= ProjectVisibility.JOINABLE
|
||||
|
||||
def is_discoverable(self):
|
||||
return self.visibility <= ProjectVisibility.DISCOVERABLE
|
||||
|
||||
|
||||
class ProjectMembership(models.Model):
|
||||
project = models.ForeignKey(Project, on_delete=models.CASCADE)
|
||||
|
||||
@@ -53,7 +53,11 @@
|
||||
<tr class="bg-white border-slate-200 border-b-2">
|
||||
<td class="w-full p-4">
|
||||
<div>
|
||||
{% if project.member or request.user.is_superuser %}
|
||||
<a href="/issues/{{ project.id }}" class="text-xl text-cyan-500 font-bold">{{ project.name }}</a>
|
||||
{% else %}
|
||||
<span class="text-xl text-slate-800 font-bold">{{ project.name }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
{{ project.team.name }}
|
||||
@@ -74,8 +78,8 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
{% if not app_settings.SINGLE_USER %}
|
||||
<td class="pr-2">
|
||||
{% if not app_settings.SINGLE_USER %}{% if project.member.is_admin or request.user.is_superuser %}
|
||||
<div class="rounded-full hover:bg-slate-100 p-2 cursor-pointer" onclick="followContainedLink(this);" >
|
||||
<a href="{% url 'project_members' project_pk=project.id %}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-8">
|
||||
@@ -83,10 +87,11 @@
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
<td class="pr-2">
|
||||
{% if project.member.is_admin or request.user.is_superuser %}
|
||||
<div class="rounded-full hover:bg-slate-100 p-2 cursor-pointer"onclick="followContainedLink(this);" >
|
||||
<a href="{% url 'project_edit' project_pk=project.id %}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-8">
|
||||
@@ -95,9 +100,11 @@
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="pr-2">
|
||||
{% if project.member or request.user.is_superuser %}
|
||||
<div class="rounded-full hover:bg-slate-100 p-2 cursor-pointer" onclick="followContainedLink(this);" >
|
||||
<a href="{% url 'project_sdk_setup' project_pk=project.id %}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-8">
|
||||
@@ -105,6 +112,7 @@
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user