From 3766dcf8732b197d12cd0cb1fe29e26297079194 Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Tue, 23 Jul 2024 20:23:42 -0700 Subject: [PATCH 1/7] feat(App): add is_orphan column to apps table Signed-off-by: Edward Ly --- .../core/migrations/0031_app_is_orphan.py | 18 ++++++++++++++++++ nextcloudappstore/core/models.py | 1 + 2 files changed, 19 insertions(+) create mode 100644 nextcloudappstore/core/migrations/0031_app_is_orphan.py diff --git a/nextcloudappstore/core/migrations/0031_app_is_orphan.py b/nextcloudappstore/core/migrations/0031_app_is_orphan.py new file mode 100644 index 00000000000..b4c5c1e982f --- /dev/null +++ b/nextcloudappstore/core/migrations/0031_app_is_orphan.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.14 on 2024-07-24 00:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0030_remove_apprelease_aa_proto_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='app', + name='is_orphan', + field=models.BooleanField(default=False, verbose_name='Orphan'), + ), + ] diff --git a/nextcloudappstore/core/models.py b/nextcloudappstore/core/models.py index d55f2fbf933..217f316f0d9 100644 --- a/nextcloudappstore/core/models.py +++ b/nextcloudappstore/core/models.py @@ -104,6 +104,7 @@ class App(TranslatableModel): ) authors = ManyToManyField("AppAuthor", blank=True, related_name="apps", verbose_name=_("App authors")) is_featured = BooleanField(verbose_name=_("Featured"), default=False) + is_orphan = BooleanField(verbose_name=_("Orphan"), default=False) rating_recent = FloatField(verbose_name=_("Recent rating"), default=0.5) rating_overall = FloatField(verbose_name=_("Overall rating"), default=0.5) rating_num_recent = IntegerField(verbose_name=_("Number of recently submitted ratings"), default=0) From 9dd578922e334d4c9c091de2d0d847abf4aa98be Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Tue, 23 Jul 2024 21:38:28 -0700 Subject: [PATCH 2/7] feat(TransferAppsView): add route to toggle is_orphan value for apps Signed-off-by: Edward Ly --- nextcloudappstore/user/urls.py | 1 + nextcloudappstore/user/views.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/nextcloudappstore/user/urls.py b/nextcloudappstore/user/urls.py index a11d1de31b8..efc6550173e 100644 --- a/nextcloudappstore/user/urls.py +++ b/nextcloudappstore/user/urls.py @@ -25,6 +25,7 @@ ), re_path(r"^transfer-apps/?$", TransferAppsView.as_view(), name="account-transfer-apps"), re_path(r"^transfer-apps/(?P[a-z0-9_]+)/?$", TransferAppsView.as_view(), name="account-transfer-app"), + re_path(r"^orphan-apps/(?P[a-z0-9_]+)/?$", TransferAppsView.as_view(), name="account-orphan-app"), re_path(r"^password/?$", PasswordView.as_view(), name="account-password"), re_path(r"^token/?$", APITokenView.as_view(), name="account-api-token"), re_path(r"^delete/?$", DeleteAccountView.as_view(), name="account-deletion"), diff --git a/nextcloudappstore/user/views.py b/nextcloudappstore/user/views.py index a93cd07f6b1..2b022629c4d 100644 --- a/nextcloudappstore/user/views.py +++ b/nextcloudappstore/user/views.py @@ -30,7 +30,10 @@ class TransferAppsView(LoginRequiredMixin, TemplateView): def post(self, request, pk): app = get_object_or_404(App, pk=pk, owner=self.request.user) - app.ownership_transfer_enabled = not app.ownership_transfer_enabled + if "transfer" in request.path: + app.ownership_transfer_enabled = not app.ownership_transfer_enabled + if "orphan" in request.path: + app.is_orphan = not app.is_orphan app.save() return redirect(reverse("user:account-transfer-apps")) From 1e7f65468f0aedeab53da68da0fd2e1f73ed6fcd Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Tue, 23 Jul 2024 23:19:39 -0700 Subject: [PATCH 3/7] fix(api): mark app as maintained after ownership transfer Signed-off-by: Edward Ly --- nextcloudappstore/api/v1/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nextcloudappstore/api/v1/views.py b/nextcloudappstore/api/v1/views.py index 5f925a94794..8d897721aa2 100644 --- a/nextcloudappstore/api/v1/views.py +++ b/nextcloudappstore/api/v1/views.py @@ -176,6 +176,7 @@ def post(self, request): if app.ownership_transfer_enabled: app.owner = request.user app.ownership_transfer_enabled = False + app.is_orphan = False elif app.owner != request.user: msg = "Only the app owner is allowed to update the certificate" raise PermissionDenied(msg) From de558b26b9ca327767002db2cf15b796755dced8 Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Tue, 23 Jul 2024 21:42:12 -0700 Subject: [PATCH 4/7] feat(transfer-apps): add columns for is_orphan values and toggle buttons Signed-off-by: Edward Ly --- .../user/templates/user/transfer-apps.html | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/nextcloudappstore/user/templates/user/transfer-apps.html b/nextcloudappstore/user/templates/user/transfer-apps.html index ea5460ac147..3c67a722bf5 100644 --- a/nextcloudappstore/user/templates/user/transfer-apps.html +++ b/nextcloudappstore/user/templates/user/transfer-apps.html @@ -8,22 +8,32 @@

{% trans "Transfer Apps" %}

{% trans 'To transfer an app to a new owner you must first unlock the app. A user can then take control of the app by registering it again on the app register page in the app developer menu.' %}

+

{% trans 'Don\'t have a new owner yet? You can mark the app as orphaned to indicate that you are looking for a new owner. Once the transfer is complete, the app will be automatically marked as un-orphaned/maintained again.' %}

{% if apps %} + + {% for app in apps %} + + {% endfor %}
{% trans 'App name' %} {% trans 'Ownership transfer status' %}{% trans 'App status' %} {% trans 'Change ownership transfer status' %}{% trans 'Change app status' %}
{{ app.name }} {% if app.ownership_transfer_enabled %} - {% trans 'Unlocked for transfer' %} + {% trans 'Unlocked' %} {% else %} - {% trans 'Locked, no transfer possible' %} + {% trans 'Locked' %} + {% endif %} + + {% if app.is_orphan %} + {% trans 'Orphaned' %} + {% else %} + {% trans 'Maintained' %} {% endif %} @@ -36,6 +46,16 @@

{% trans "Transfer Apps" %}

{% endif %}
+
+ {% csrf_token %} + {% if app.is_orphan %} + + {% else %} + + {% endif %} +
+
From a61c48f65b03159c4d017558d3d1d967fe9a1ee1 Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Tue, 23 Jul 2024 22:45:40 -0700 Subject: [PATCH 5/7] fix(transfer-apps): center table contents Signed-off-by: Edward Ly --- nextcloudappstore/core/static/assets/css/style.css | 10 ++++++++++ .../user/templates/user/transfer-apps.html | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nextcloudappstore/core/static/assets/css/style.css b/nextcloudappstore/core/static/assets/css/style.css index 6471029c39e..fb560b91e9c 100644 --- a/nextcloudappstore/core/static/assets/css/style.css +++ b/nextcloudappstore/core/static/assets/css/style.css @@ -1121,3 +1121,13 @@ form .form-group input[type=checkbox] { .account-content { margin-bottom: 60px; } + +.transfer-apps th:not(:first-child), +.transfer-apps td:not(:first-child) { + text-align: center; +} + +.transfer-apps form { + display: flex; + justify-content: center; +} diff --git a/nextcloudappstore/user/templates/user/transfer-apps.html b/nextcloudappstore/user/templates/user/transfer-apps.html index 3c67a722bf5..b9f11336503 100644 --- a/nextcloudappstore/user/templates/user/transfer-apps.html +++ b/nextcloudappstore/user/templates/user/transfer-apps.html @@ -11,7 +11,7 @@

{% trans "Transfer Apps" %}

{% trans 'Don\'t have a new owner yet? You can mark the app as orphaned to indicate that you are looking for a new owner. Once the transfer is complete, the app will be automatically marked as un-orphaned/maintained again.' %}

{% if apps %} - +
From e11c31106bf94f751564604334ae3d6d027c3674 Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Tue, 23 Jul 2024 23:26:50 -0700 Subject: [PATCH 6/7] fix(AppAdmin): display is_orphan column in apps admin view Signed-off-by: Edward Ly --- nextcloudappstore/core/admin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nextcloudappstore/core/admin.py b/nextcloudappstore/core/admin.py index fe0c8eb1c3d..24924562cb6 100644 --- a/nextcloudappstore/core/admin.py +++ b/nextcloudappstore/core/admin.py @@ -70,6 +70,7 @@ class AppAdmin(TranslatableAdmin): "summary", "is_featured", "ownership_transfer_enabled", + "is_orphan", "is_integration", "approved", ) @@ -81,6 +82,7 @@ class AppAdmin(TranslatableAdmin): "is_featured", "last_release", "ownership_transfer_enabled", + "is_orphan", "is_integration", "approved", ) From f5e03d01254759f64d1b57dbb9cb85bdc524a294 Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Wed, 24 Jul 2024 08:17:41 -0700 Subject: [PATCH 7/7] feat(detail): add tag indicator for orphaned apps Signed-off-by: Edward Ly --- nextcloudappstore/core/static/assets/css/style.css | 5 +++++ nextcloudappstore/core/templates/app/detail.html | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/nextcloudappstore/core/static/assets/css/style.css b/nextcloudappstore/core/static/assets/css/style.css index fb560b91e9c..f59dbc20861 100644 --- a/nextcloudappstore/core/static/assets/css/style.css +++ b/nextcloudappstore/core/static/assets/css/style.css @@ -62,6 +62,11 @@ body { border-radius: 3px; } +.tag-danger { + color: var(--color-error); + border: 1px solid var(--color-error-hover); +} + #footer { position: absolute; bottom: 0; diff --git a/nextcloudappstore/core/templates/app/detail.html b/nextcloudappstore/core/templates/app/detail.html index aeb3cac2cdc..281d0d0541f 100644 --- a/nextcloudappstore/core/templates/app/detail.html +++ b/nextcloudappstore/core/templates/app/detail.html @@ -40,7 +40,9 @@ {% endif %}
-

{{ object.name }}

{% if object.is_featured %}{% trans "Featured" %}{% endif %} +

{{ object.name }}

+ {% if object.is_featured %}{% trans "Featured" %}{% endif %} + {% if object.is_orphan %}{% trans "Orphan / Looking for Maintainer" %}{% endif %}
{% trans 'App name' %} {% trans 'Ownership transfer status' %}