This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch gc/8558
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 8cb617ce7bf07e97b3cc753d7745783d1742fe6c
Author: Guillermo Cruz <guillermo.c...@slashdotmedia.com>
AuthorDate: Thu May 9 14:33:08 2024 -0600

    [#8558] make sure all user prefs changes get indexed by solr
---
 Allura/allura/controllers/auth.py | 2 +-
 Allura/allura/model/auth.py       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Allura/allura/controllers/auth.py 
b/Allura/allura/controllers/auth.py
index 3f3f82fdb..555ac4d95 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -623,7 +623,7 @@ class PreferencesController(BaseController):
                     flash('You must provide your current password to delete an 
email', 'error')
                     return
                 if primary_addr == user.email_addresses[i]:
-                    if select_new_primary_addr(user, 
ignore_emails=primary_addr) is None \
+                    if select_new_primary_addr(user, 
ignore_emails=[primary_addr]) is None \
                             and asbool(config.get('auth.require_email_addr', 
False)):
                         flash('You must have at least one verified email 
address.', 'error')
                         return
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 74652226a..0b73f1b34 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -865,6 +865,11 @@ class User(MappedClass, ActivityNode, ActivityObject, 
SearchIndexable):
         p = plugin.AuthenticationProvider.get(request)
         return p.user_registration_date(self)
 
+    # overriding since the old and new values are not being tracked for 
changes within a dictionary like preferences
+    #  This will ensure any changes get indexed by solr.
+    def should_update_index(self, old_doc, new_doc):
+        return True
+
 
 class ProjectRole(MappedClass):
     """

Reply via email to