Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions src/webview/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
# Generated by Django 4.2.16 on 2025-04-30 14:20

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('shared', '0047_alter_cvederivationclusterproposal_status_and_more'),
("shared", "0047_alter_cvederivationclusterproposal_status_and_more"),
]

operations = [
migrations.CreateModel(
name='Profile',
name="Profile",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('subscriptions', models.ManyToManyField(related_name='subscribers', to='shared.nixpkgsissue')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"subscriptions",
models.ManyToManyField(
related_name="subscribers", to="shared.nixpkgsissue"
),
),
(
"user",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
),
]
36 changes: 25 additions & 11 deletions src/webview/migrations/0002_notification.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
# Generated by Django 4.2.23 on 2025-09-30 14:41

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('webview', '0001_initial'),
("webview", "0001_initial"),
]

operations = [
migrations.CreateModel(
name='Notification',
name="Notification",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('message', models.TextField()),
('is_read', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to=settings.AUTH_USER_MODEL)),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=255)),
("message", models.TextField()),
("is_read", models.BooleanField(default=False)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="notifications",
to=settings.AUTH_USER_MODEL,
),
),
],
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@


class Migration(migrations.Migration):

dependencies = [
('webview', '0002_notification'),
("webview", "0002_notification"),
]

operations = [
migrations.AddField(
model_name='profile',
name='unread_notifications_count',
model_name="profile",
name="unread_notifications_count",
field=models.PositiveIntegerField(default=0),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@


class Migration(migrations.Migration):

dependencies = [
('webview', '0003_profile_unread_notifications_count'),
("webview", "0003_profile_unread_notifications_count"),
]

operations = [
migrations.RemoveField(
model_name='profile',
name='subscriptions',
model_name="profile",
name="subscriptions",
),
migrations.AddField(
model_name='profile',
name='package_subscriptions',
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, help_text="Package attribute names this user has subscribed to (e.g., 'firefox', 'chromium')", size=None),
model_name="profile",
name="package_subscriptions",
field=django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(max_length=255),
blank=True,
default=list,
help_text="Package attribute names this user has subscribed to (e.g., 'firefox', 'chromium')",
size=None,
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,28 @@


class Migration(migrations.Migration):

dependencies = [
('webview', '0004_remove_profile_subscriptions_and_more'),
("webview", "0004_remove_profile_subscriptions_and_more"),
]

operations = [
migrations.AddField(
model_name='profile',
name='auto_subscribe_to_maintained_packages',
field=models.BooleanField(default=True, help_text='Automatically subscribe to notifications for packages this user maintains'),
model_name="profile",
name="auto_subscribe_to_maintained_packages",
field=models.BooleanField(
default=True,
help_text="Automatically subscribe to notifications for packages this user maintains",
),
),
migrations.AlterField(
model_name='profile',
name='package_subscriptions',
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, help_text="Package attribute names this user has subscribed to manually (e.g., 'firefox', 'chromium')", size=None),
model_name="profile",
name="package_subscriptions",
field=django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(max_length=255),
blank=True,
default=list,
help_text="Package attribute names this user has subscribed to manually (e.g., 'firefox', 'chromium')",
size=None,
),
),
]
31 changes: 23 additions & 8 deletions src/webview/migrations/0006_suggestionnotification.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,37 @@


class Migration(migrations.Migration):

dependencies = [
('shared', '0067_remove_nixchannel_pgpubsub_ae5b1_and_more'),
('webview', '0005_profile_auto_subscribe_to_maintained_packages_and_more'),
("shared", "0067_remove_nixchannel_pgpubsub_ae5b1_and_more"),
("webview", "0005_profile_auto_subscribe_to_maintained_packages_and_more"),
]

operations = [
migrations.CreateModel(
name='SuggestionNotification',
name="SuggestionNotification",
fields=[
('notification_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='webview.notification')),
('suggestion', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='shared.cvederivationclusterproposal')),
(
"notification_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="webview.notification",
),
),
(
"suggestion",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
to="shared.cvederivationclusterproposal",
),
),
],
options={
'abstract': False,
"abstract": False,
},
bases=('webview.notification',),
bases=("webview.notification",),
),
]
48 changes: 29 additions & 19 deletions src/webview/migrations/0007_remove_notification_message_and_more.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def migrate_notifications_to_text(apps, schema_editor):


def reverse_migration(apps, schema_editor):
Notification = apps.get_model('webview', 'Notification')
TextNotification = apps.get_model('webview', 'TextNotification')
Notification = apps.get_model("webview", "Notification")
TextNotification = apps.get_model("webview", "TextNotification")

for text_notif in TextNotification.objects.all():
Notification.objects.filter(pk=text_notif.pk).update(
Expand All @@ -30,39 +30,49 @@ def reverse_migration(apps, schema_editor):

class Migration(migrations.Migration):
dependencies = [
('webview', '0006_suggestionnotification'),
("webview", "0006_suggestionnotification"),
]

operations = [
migrations.RenameField(
model_name='notification',
old_name='title',
new_name='_title',
model_name="notification",
old_name="title",
new_name="_title",
),
migrations.RenameField(
model_name='notification',
old_name='message',
new_name='_message',
model_name="notification",
old_name="message",
new_name="_message",
),
migrations.CreateModel(
name='TextNotification',
name="TextNotification",
fields=[
('notification_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='webview.notification')),
('title', models.CharField(max_length=255)),
('message', models.TextField()),
(
"notification_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="webview.notification",
),
),
("title", models.CharField(max_length=255)),
("message", models.TextField()),
],
options={
'abstract': False,
"abstract": False,
},
bases=('webview.notification',),
bases=("webview.notification",),
),
migrations.RunPython(migrate_notifications_to_text, reverse_migration),
migrations.RemoveField(
model_name='notification',
name='_title',
model_name="notification",
name="_title",
),
migrations.RemoveField(
model_name='notification',
name='_message',
model_name="notification",
name="_message",
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@


class Migration(migrations.Migration):

dependencies = [
('shared', '0073_alter_affectedproduct_default_status_and_more'),
('webview', '0007_remove_notification_message_and_more'),
("shared", "0073_alter_affectedproduct_default_status_and_more"),
("webview", "0007_remove_notification_message_and_more"),
]

operations = [
migrations.AlterField(
model_name='suggestionnotification',
name='suggestion',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shared.cvederivationclusterproposal'),
model_name="suggestionnotification",
name="suggestion",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="shared.cvederivationclusterproposal",
),
),
]
10 changes: 5 additions & 5 deletions src/webview/templates/components/issue.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% load viewutils %}

<article class="rounded-box column gap" id="issue-{{ issue.code }}">
<article class="rounded-box column gap" id="issue-{{ data.issue.code }}">

<div class="row gap spread">
<div class="uppercase bold">{{ issue.code }}</div>
<div class="uppercase bold">{{ data.issue.code }}</div>
<div>
{% if github_issue %}<a href="{{ github_issue }}" target="_blank" class="permalink">GitHub issue</a>{% endif %}
published on {{ issue.created }}
{% if data.github_issue %}<a href="{{ data.github_issue }}" target="_blank" class="permalink">GitHub issue</a>{% endif %}
published on {{ data.issue.created }}
</div>
</div>

{% suggestion suggestion_context %}
{% suggestion data.suggestion_context %}

</article>
6 changes: 3 additions & 3 deletions src/webview/templates/issue_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
{% load viewutils %}

{% block title %}
{{ issue }}
{{ issue_context.issue }}
{% endblock title %}

{% block content %}

<h1 class="page-title">Details of issue {{ object.code }}</h1>
<h1 class="page-title">Details of issue {{ issue_context.issue.code }}</h1>

{% issue object suggestion_context github_issue %}
{% issue issue_context %}

{% endblock content %}
4 changes: 2 additions & 2 deletions src/webview/templates/issue_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ <h1 class="page-title row gap-small centered">{% status_icon "published" %}Publi
</div>

<div class="column gap">
{% for object in object_list %}
{% issue object object.suggestion_context github_issue=object.github_issue show_permalink=True %}
{% for issue_context in issue_contexts %}
{% issue issue_context %}
{% endfor %}
</div>
{% endblock content %}
Loading
Loading