Closed Bug 955410 Opened 10 years ago Closed 10 years ago

Concatenated logs don't work for buddies and contacts

Categories

(Chat Core :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aleth, Assigned: aleth)

References

Details

Attachments

(2 files, 1 obsolete file)

*** Original post on bio 1973 at 2013-05-24 19:30:00 UTC ***

getLogsForBuddy and getLogsForContact do not currently have a GroupByDay parameter, but are called with this parameter set to true.
Attached patch Patch (obsolete) — Splinter Review
*** Original post on bio 1973 as attmnt 2454 at 2013-05-24 21:05:00 UTC ***

This adds the optional parameter to the functions that lack it in the idl. I also took the opportunity to remove at least some of the duplication in the surrounding code in logger.js.

I also removed the unused getLogsForAccountBuddy from the idl, replacing it with getLogsForAccountAndName, which just exposes what was previously _enumerateLogs. This will be useful to get the logs for chat participants in the near future ;)
Attachment #8354221 - Flags: feedback?(florian)
Assignee: nobody → aleth
Status: NEW → ASSIGNED
Blocks: 953891
Comment on attachment 8354221 [details] [diff] [review]
Patch

*** Original change on bio 1973 attmnt 2454 at 2013-05-30 23:03:31 UTC ***

>diff --git a/components/logger.js b/components/logger.js

>+  getLogsForContact: function logger_getLogsForContact(aContact, aGroupByDay) {

>-    return new LogEnumerator(entries);
>+    let enumerator = aGroupByDay ? DailyLogEnumerator : LogEnumerator;
>+    return new enumerator(entries);

This is duplicated 3 times, and I don't see a good reason for it.


>-  getLogsForAccountBuddy: function logger_getLogsForAccountBuddy(aAccountBuddy)
>-    this._enumerateLogs(aAccountBuddy.account, aAccountBuddy.normalizedName),

I don't think 'this isn't currently used' is a good reason to get rid of this API.

>   getLogsForConversation: function logger_getLogsForConversation(aConversation,

>+    return getLogsForAccountAndName(aConversation.account, name, aGroupByDay);

Did you mean *this.*getLogsForAccountAndName.

>   getSystemLogsForAccount: function logger_getSystemLogsForAccount(aAccount)
>-    this._enumerateLogs(aAccount, ".system"),
>+    getLogsForAccountAndName(aAccount, ".system"),

And here too.


>diff --git a/imILogger.idl b/imILogger.idl

>+  nsISimpleEnumerator getLogsForAccountAndName(in imIAccount aAccount,
>+                                               in string aNormalizedName,
>+                                               [optional] in boolean aGroupByDay);

A comment may be useful here, to say what it is for. Doesn't have to be long, something like "Get logs for a username that may not be in the contact list." is enough.
Attachment #8354221 - Flags: feedback?(florian) → review-
Attached patch Finished patchSplinter Review
*** Original post on bio 1973 as attmnt 2471 at 2013-05-31 12:57:00 UTC ***

Thanks for the feedback!
Attachment #8354238 - Flags: review?(florian)
Comment on attachment 8354221 [details] [diff] [review]
Patch

*** Original change on bio 1973 attmnt 2454 at 2013-05-31 12:57:18 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8354221 - Attachment is obsolete: true
Comment on attachment 8354238 [details] [diff] [review]
Finished patch

*** Original change on bio 1973 attmnt 2471 at 2013-06-23 09:31:53 UTC ***

Thanks, sorry for the delay.
Attachment #8354238 - Flags: review?(florian) → review+
*** Original post on bio 1973 at 2013-06-23 16:51:00 UTC ***

http://hg.instantbird.org/instantbird/rev/55e90d090581
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.5
*** Original post on bio 1973 as attmnt 2511 at 2013-06-24 09:15:00 UTC ***

Sorry about these missing commas :-S
Attachment #8354279 - Flags: review?(florian)
Comment on attachment 8354279 [details] [diff] [review]
Followup to fix bustage due to typos

*** Original change on bio 1973 attmnt 2511 at 2013-06-24 09:19:39 UTC ***

http://hg.instantbird.org/instantbird/rev/d9a8debfce78
Attachment #8354279 - Flags: review?(florian) → review+
You need to log in before you can comment on or make changes to this bug.