Email convert to calendar event sometimes sets event start time later than end time disabling save

RESOLVED FIXED in 5.2

Status

Calendar
Internal Components
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: bdj, Assigned: merike)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0
Build ID: 20160502172042

Steps to reproduce:

1. Following a computer crash and recovery, had to install new software.  Installed version 45.1.0 of Thunderbird.  This install came with an automatic install of Lightning.  While looking for holiday updates for the calendar in add-ons I came across LightBird and installed that.

2. I right-clicked on an email invitation I received and selected convert to event.  A new event screen popped up with all the relevant information filled in.  However, the "Save and Close" button was disabled.  I clicked the "x" box and a message popped up saying the event wasn't saved and gave me an option to save or discard.  I chose save.  The new event screen then disappeared and, when I switched to Calendar, the event was not on the calendar.

3. I tried disabling Lightning and LightBird and restarting Thunderbird.  I then enabled Lightening alone.  I then tried the procedure in paragraph 2 with the same result. (I had not re-enabled LightBird to be sure that the problem wasn't in that add-on).

4.  I thought that possibly I needed to restart the computer (Windows 8.1).  So I disabled Lightning, uninstalled Thunderbird and rebooted.  I reinstalled Thunderbird, reinstalled Lightning, and tried  paragraph 2 again with no change in results.

5.  At this point, for me, there was the issue of Thunderbird/Calendar on one side, and my need to post the event on the other.  I right-clicked on the email and brought up a new event screen with the disabled save and went to the calendar and double-clicked on the date and a blank new event screen popped up.  I copied the information from the "convert" screen to the "calendar" screen whose save option was active.  I saved the "calendar generated event and the event showed in the calendar.  When I went back to the email page, the "convert" screen was still there but immediately disappeared as if sucked up by a vacuum.


Actual results:

In each attempt to use the convert to event feature, the screen showed up with the information from the email populating the fields but with the "save and close" button disabled.

Paragraph 5 above where the "convert" screen disappears after I manually create the event suggests to me that there is a damaged connection somewhere in the code that prevents "convert" from working but recognizes, somehow, when a like record is created manually.


Expected results:

As my past experience with the convert feature indicates, the convert to event should have produced a new event page with an active "save and close" and the fields populated with information from the email.  When I click "save and close", the event is saved and appears as an item on the calendar for the day of the event.
(Reporter)

Updated

2 years ago
OS: Unspecified → Windows 8

Comment 1

2 years ago
Please see in Tools->Error console if there are any errors when the process you are trying fails.

Comment 2

2 years ago
Wasn't able to reproduce the bug. Windows 8, Thunderbird 45.1 ."Save and close" button was enabled and "Convert to event" worked fine.

Comment 3

2 years ago
There's already a report for 4.5 - see bug 1272907.
Component: Untriaged → Internal Components
Product: Thunderbird → Calendar
Version: 45 Branch → Lightning 4.7.1
(Reporter)

Comment 4

2 years ago
Acknowledging that there was a prior bug report, I have more information.
At the end of my previous posts - to my knowledge from what was visible, I had one calendar event that I had created manually by copying the event as created by the convert utility but not saved.  

I also want to recap that this install of Thunderbird, Lightning, and LightBird, occurred after my hard drive crashed and a new hard drive installed with a complete reinstall of windows.  In my computer setup prior to the crash I had used the convert to utility many times with no problem.  LightBird was a completely new install after the computer repair.

Following the comment by Anindya-Pandey about the successful creation of an event, I went back and tried again. At this point, LightBird was not activated. I right-clicked on the email and selected convert to event.  The new event screen popped up with the save and close button disabled. 

Because my use of the convert utility, prior to my hard drive crash, was always successful, this time I looked at the contents of the event to see if everything was correctly transcribed.  To my surprise, I found that the "to" date was earlier than the "from" date.  In checking the contents of the email as transcribed under the "description" tab, I found that, at the bottom of the text, it indicated the rsvp date, which is obviously earlier than the event date.  So the convert utility put the event date in the "from" line and the rsvp date in the "to" line, an obviously illogical sequence for the utility.

I corrected the "to" to be the same as the "from" date and the "save and close" button was activated.  I saved the event and it showed up on the calendar with the manually created event.  I deleted one of the events - not sure, but I think I deleted the manually created event.

Ok, now that I successfully created an event from the convert utlity, I activated LightBird.  

On all of my attempts and two successes, manual and conversion, I selected a reminder 1 week before the event.  This morning I received two reminders for the event.  I had left only one event on the calendar.  I clicked on "details" for the first reminder and the event page popped up.  I closed it and clicked "dismiss".  The first reminder went away.  I did the same with the second reminder:  with "details" the event page popped up; with clicking "dismiss" the reminder disappeared.  I then went to the calendar, and there was no event listed.  My first thought was that the reminders were from the failed attempts - where when I clicked the "x" on the converted events with the disabled button.

But I decided to try it again.  I right-clicked on the email, chose convert to event, chose a 2-day-before reminder, changed the "to" date which activated the "save and close" button, and saved the event.  Then I went over to the freestanding calendar (via LightBird), and the event wasn't there.  I disabled LightBird, restarted Thunderbird, and converted the email again.  The event appeared on the calendar.  I re-enable LightBird again and the event disappeared.  I disabled LightBird, restarted Thunerbird, created the event again, but this time I am not enabling LightBird.

Now, one problem is obviously with LightBird, but there is still a problem with Lightning in that if the conversion results in an illogical sequence of dates/times, a user might not know that there is wrong information.  The event email I received was in a graphic link to an evite site.  Apparently all the information was hidden by the graphic.  It would be helpful if a logic check was made on dates/times and an error message sent to the user.

However, how do I proceed with these two identifiable problems?  Shall I put a link to this report in the other bug 1272907?  Shall I create a new bug for LightBird?

Thanks to aceman, Anindya-Pandey, and MakeMyDay for your help
(Assignee)

Comment 5

2 years ago
Bug 1272907 is about conversion in the opposite direction and is unlikely related to the fact that sometimes extraction can end up with start time later than end time as described in comment 4.

I've managed to compose an email showing the same issue locally. I'm a bit surprised that no one hasn't complained about it earlier but maybe it occurs rarely enough. I'll try to take a look later next week what can be done to avoid this situation during conversion.

Bugs about LightBird should be reported to its developer. Github tracker at https://github.com/Exalm/lightbird/issues seems to be the place for that.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Email convert to calendar event not working propery → Email convert to calendar event sometimes sets event start time later than end time disabling save
(Assignee)

Comment 6

2 years ago
Created attachment 8760920 [details] [diff] [review]
negGuessFix

This should do it for cases like these. If there's a better way to avoid using undefined values I'd like to know it :)
Assignee: nobody → merikes.lists
Status: NEW → ASSIGNED
Attachment #8760920 - Flags: review?(philipp)
(Assignee)

Updated

2 years ago
OS: Windows 8 → All
Hardware: Unspecified → All
Version: Lightning 4.7.1 → Trunk
Comment on attachment 8760920 [details] [diff] [review]
negGuessFix

Review of attachment 8760920 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with the following considered, feel free to upload a second patch for review if you are unsure:

::: calendar/base/modules/calExtract.jsm
@@ +962,5 @@
> +            // no zero or negative length events/tasks
> +            let startTime = new Date(start.year || 0, start.month - 1 || 0, start.day || 0,
> +                                     start.hour || 0, start.minute || 0).getTime();
> +            let guessTime = new Date(guess.year || 0, guess.month - 1 || 0, guess.day || 0,
> +                                     guess.hour || 0, guess.minute || 0).getTime();

You could use start.nativeTime and subtract the seconds to get a nativeTime rounded to minutes, do the same with guessTime, then compare those values. I believe nativeTime is in microseconds, so be careful with the multiplication factor.
Attachment #8760920 - Flags: review?(philipp) → review+
(Assignee)

Comment 8

2 years ago
> You could use start.nativeTime and subtract the seconds to get a nativeTime
> rounded to minutes, do the same with guessTime, then compare those values. I
> believe nativeTime is in microseconds, so be careful with the multiplication
> factor.

This would only work if this was a calDateTime as far as I understand it. But it's a custom object where parts of it may be undefined. So I guess there isn't a simpler or more elegant way to do the comparison here.
(Assignee)

Updated

2 years ago
Keywords: checkin-needed

Comment 9

2 years ago
https://hg.mozilla.org/comm-central/rev/209456d7f0f0
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 5.2
You need to log in before you can comment on or make changes to this bug.