adding a card in a mail list trigger event of adding a new card in the directory even if no new card was created in the process
Categories
(Thunderbird :: Address Book, defect)
Tracking
(thunderbird_esr78 fixed, thunderbird80 fixed)
People
(Reporter: gfritos, Assigned: darktrojan)
References
Details
Attachments
(1 file)
(deleted),
patch
|
khushil324
:
review+
wsmwk
:
approval-comm-beta+
wsmwk
:
approval-comm-esr78+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.40
Steps to reproduce:
- create contact john@test.lan in an addressbook
- create a mail list in the same addresssbook and add john@test.lan in the members
Actual results:
Event of adding a new contact in the addressbook is emitted.
Expected results:
The event must not have been emitted.
The problem is here : par of code from https://searchfox.org/comm-central/source/mailnews/addrbook/jsaddrbook/AddrBookMailingList.jsm#118
addCard(card) {
if (!card.primaryEmail) {
return card;
}
if (!self._parent.hasCard(card)) {
self._parent.addCard(card);
}
let insertStatement = self._parent._dbConnection.createStatement(
"REPLACE INTO list_cards (list, card) VALUES (:list, :card)"
);
insertStatement.params.list = self._uid;
insertStatement.params.card = card.UID;
insertStatement.execute();
MailServices.ab.notifyItemPropertyChanged(card, null, null, null);
MailServices.ab.notifyItemPropertyChanged(card, null, null, null);
MailServices.ab.notifyDirectoryItemAdded(self._parent, card);
MailServices.ab.notifyDirectoryItemAdded(this, card);
Services.obs.notifyObservers(
card,
"addrbook-list-member-added",
self._uid
);
insertStatement.finalize();
return card;
},
Event if :
self._parent.hasCard(card) is true
the event :
MailServices.ab.notifyDirectoryItemAdded(self._parent, card);
is emitted.
Comment 1•4 years ago
|
||
Geoff, please take this one
Assignee | ||
Comment 2•4 years ago
|
||
I think this has always been the case. It was in my test which ensured the new address book had the same behaviour as the old address book. Regardless, it is stupid, so let's get rid of it.
FYI reporter, in the future we'll only have the observer service notifications, so if you're using nsIAbListener you might want to migrate.
Comment 3•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/608120887e25
Stop erroneously firing onItemAdded when a contact is added to a mailing list. r=khushil
Assignee | ||
Updated•4 years ago
|
Comment 5•4 years ago
|
||
Comment 6•4 years ago
|
||
bugherder uplift |
Thunderbird 80.0b1:
https://hg.mozilla.org/releases/comm-beta/rev/1ef07bf9eec7
Updated•4 years ago
|
Comment 7•4 years ago
|
||
Comment 8•4 years ago
|
||
bugherder uplift |
Thunderbird 78.1.1:
https://hg.mozilla.org/releases/comm-esr78/rev/1868361196ba
Description
•