Closed Bug 79792 Opened 23 years ago Closed 23 years ago

Changes to LDAP autocomplete prefs not honored if composition window open

Categories

(MailNews Core :: Composition, defect, P3)

x86
Windows NT

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: hong_bugmail, Assigned: srilatha)

References

Details

(Whiteboard: [PDT+], ready for checkin)

Attachments

(12 files)

From Bugzilla Helper:
User-Agent: Mozilla/4.78b1 [en] (Windows NT 5.0; U)
BuildID:    2001050804

If you change your LDAP autocompletion settings (either the global autocomplete 
in Preferences or the per-account autocomplete in Mail & News Account Settings) 
while the composition window is open, the changes are not reflected until the 
composition window is closed and a new one is open.  



Reproducible: Always
Steps to Reproduce:
Scenario 1:

1. Make sure local address book AND ldap autocomplete off.
2. Open compose.
3. Type email address (hong for example)
4. Open Preferences->Mail&Newsgroups->Address Books
5. Enable LDAP autocomplete (make sure you have a server)
6. Erase the email address, or add a new one

Expected Results

Autocompletion occurs against directory

Actual result

No autocompletion occurs 

Scenario 2

1. make sure global autocomplete turned on, and per-account is turned OFF.
2. open compose window.
3. open Mail & News Account Settings->[your test account]->Server Settings->LDAP 
Directory Server
4. Click on Override and pick "None"
5. Close Account Settings
6. Type in 'hong'

Expected Results

No autocompletion occurs.

Actual result:

Autocompletion occurs.


This happens to changes in both the Preferences and the Mail Account Setup 
prefs.  The prefs are only being read for LDAP autocomplete when the window is 
not invoked, not for each autocomplete session.

This isn't a general addressbook problem because the behavior is different if 
you turn on local addressbook autocomplete while the composition window 
(autocompletion is toggled correctly).

This is a 4x parity problem as if you change the autocomplete settings while 
composing a mail msg, the settings are correctly applied in real time.
Keywords: 4xp
QA Contact: esther → yulian
Target Milestone: --- → mozilla0.9.2
Priority: -- → P3
Depends on: 82169
PDT+ per 6/12 mtg.
Whiteboard: [PDT+]
Status: NEW → ASSIGNED
Depends on: 79939
Attached patch patch v1Splinter Review
The above patch fixes both this bug and bug 80783 -ldap autocomplete should                                          
respect online/offline setting 
Whiteboard: [PDT+] → [PDT+], Have a fix. Need an r=
ccin mohanb for an r=, sspitzer for an sr=
Depends on: 86425
Depends on: 84577
No longer depends on: 86425
Previous iteration of the patch reintroduced some old code which has since been
revised in CVS.  This version fixes several regressions caused by that.  Also
cleans up formatting in setupLdapAutocompleteSession.
r=mohanb;
with the above patch, autocompletion doesn't work. Still trying to fix it.
No longer depends on: 82169
Attached patch patch v4Splinter Review
With the latest patch autocompletion works only fot the first address field.
Attached patch patch v5Splinter Review
Attached patch Patch v6Splinter Review
with the latest patch autocomplete should work for all recipients
Attached patch patch v7Splinter Review
looks good - sr=hewitt
Attached patch path v8Splinter Review
In the latest patch, the addSession gets called for all the recipients rather 
than jus recipient#1.

ccing ducarroz for an r=
hewitt, does your sr= still apply?
Whiteboard: [PDT+], Have a fix. Need an r= → [PDT+], Have a fix,sr= Need an r=
Few comments:

1)
@@ -558,6 +564,11 @@
     // sanity checks
     if (topic != "network:offline-status-changed") return;
     MessageComposeOfflineStateChanged(state == "offline");
+    if (state == "offline")
+      isOffline = true;
+    else
+      isOffline = false;
+    setupLdapAutocompleteSession();

can you do something like:
  isOffline = (state == "offline");
  MessageComposeOfflineStateChanged(isOffline);
  setupLdapAutocompleteSession();

2)
@@ -566,6 +577,7 @@
   var observerService =
Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
   observerService.AddObserver(messageComposeOfflineObserver,
"network:offline-status-changed");
   
+  isOffline = ioService.offline;
   // set the initial state of the send button
   MessageComposeOfflineStateChanged(ioService.offline);


can you pass isOffline to MessageComposeOfflineStateChanged() ?

3)
+function RemoveDirectoryServerObserver(prefstring)
+{
+  if (!prefstring) {
+    prefs.removeObserver("ldap_2.autoComplete.useDirectory",
directoryServerObserver);
+    prefs.removeObserver("ldap_2.autoComplete.directoryServer",
directoryServerObserver);
+  }
+  else
+  {
+    var str = prefstring + ".overrideGlobalPref";
+    prefs.removeObserver(prefstring, directoryServerObserver);
+    str = prefstring + ".directoryServer";
+    prefs.removeObserver(prefstring, directoryServerObserver);
+  }
+}

Something seems wrong here! either you don't need the variable str but then why
call twice prefs.removeObserver or
you need to pass str to the function prefs.removeObserver instead of prefstring.

4) Do we need to remove the seesion when we remove a recipient row?
Attached patch patch v9Splinter Review
The above patch does 1,2 and3 from ducarroz's comments.
4) Do we need to remove the seesion when we remove a recipient row?
I am not sure, but I think we do not have because it just holding a reference to 
the sessions and the references should go away when we remove the widget. 
i am assuming that we remove the widget associated with a row when we remove 
that recipient row.
Hewitt, what is your take on it?
much better. R=ducarroz
Whiteboard: [PDT+], Have a fix,sr= Need an r= → [PDT+], Have a fix, r=, waiting for sr= on the last patch
looks good - sr=hewitt
Whiteboard: [PDT+], Have a fix, r=, waiting for sr= on the last patch → [PDT+], Have a fix, r=, sr=, need a=
Attached patch patch v10Splinter Review
In the last patch, overrideGlobalPref is changed to overrideGlobal_Pref in add 
and remove observer because the mail.identity.<idkey>.overrideGlobal_Pref is 
preference we save.
Tested this patch on windows and mac.
a= asa@mozilla.org for checkin to frozen 0.9.2.
(on behalf of drivers)
Testing that has to be done with this fix:
All the test cases in the following bugs
bug 79939
bug 79792
bug 80783
bug 82169
bug 81761

And try these test cases with more than one recipient. 
Try if autocompletion works for more than one recipient.
Delete and add recipients and see if autocompletion works for all recipients.

Test if autocompletion works for all recipients after cahnging global or 
mail/news account specific autcompletion preferences.

Test if autocompletion happens against the right ldap server with more than one 
compose window(each with a different identity) open, when you switch between 
windows.
the above comments are to help qa in testing this fix. It is important that this 
fix is tested with mutiple recipients.
Whiteboard: [PDT+], Have a fix, r=, sr=, need a= → [PDT+], Have a fix, r=, sr=, need a=, critical for 0.9.2
Whiteboard: [PDT+], Have a fix, r=, sr=, need a=, critical for 0.9.2 → [PDT+], ready for checkin
Fix checked in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
*** Bug 84577 has been marked as a duplicate of this bug. ***
Verified with 2001062204 builds on all platforms.
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: