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

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new 85ab8921e [#8558] make sure all user prefs changes get indexed by solr
85ab8921e is described below

commit 85ab8921e91900f158ea88f092cb3a58afa5de57
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 cade4f936..61bfd7d75 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