From 0d26119ff31bd1c1906e006dddba3594163aac6f Mon Sep 17 00:00:00 2001
From: Christoph Berg <myon@debian.org>
Date: Fri, 16 Oct 2026 19:09:12 +0200
Subject: [PATCH v14 12/12] Don't re-purge contributor pages on a no-op account
 save

The account profile view saved the contributor form on every POST whenever
the user has a contributor record, even when nothing in it had changed.
That fired the contributor post_save handler, which purges the curated
list, the people list, the user's own profile page and every badge page
that lists them - all for a form that changed nothing.

Only save the form when it actually changed.
---
 pgweb/account/views.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pgweb/account/views.py b/pgweb/account/views.py
index 986f3827..cc5a6c18 100644
--- a/pgweb/account/views.py
+++ b/pgweb/account/views.py
@@ -187,7 +187,9 @@ def profile(request):
             profileform.save()
             if badges and 'create_contributor_profile' in request.POST and request.POST['create_contributor_profile']:
                 contrib = Contributor.objects.create(user=user, firstname=user.first_name, lastname=user.last_name, email=user.email)
-            elif contrib:
+            elif contrib and contribform.has_changed():
+                # Skip no-op saves: the contributor post_save handler purges the
+                # curated list, the people list and all of the user's badge pages.
                 contribform.save()
             if secondaryemailform.cleaned_data.get('email1', ''):
                 sa = SecondaryEmail(user=request.user, email=secondaryemailform.cleaned_data['email1'], token=generate_random_token())
-- 
2.53.0

