Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Can't update tasks/events descriptions #5

Closed
smvicente opened this issue May 31, 2017 · 27 comments
Closed

Can't update tasks/events descriptions #5

smvicente opened this issue May 31, 2017 · 27 comments
Assignees

Comments

@smvicente
Copy link

Since the update to Thunderbird 52.1.1, Lightning 5.4 and EWS Provider v4.0.0-beta1, I can not update task's descriptions from Thunderbird as before, as they get always overwritten with the one in the server right after saving.

Calendar and new tasks creations seems to sync well, but I can't live without been able to modify the descriptions as before :(

I really love this addon! So I can't imagine working without this functionality. I know the effort you guys have to make so I will very grateful if someone can help with this. Anyone else with this problem?

Best.

@advancingu
Copy link
Member

Did this issue exist for you in previous versions or is this new in v4.0.0-beta1?

@smvicente
Copy link
Author

smvicente commented May 31, 2017

Hi @advancingu!!

Thank you for answering! Yes, it is happening since the update. Tried with all the versions published in this thread with the same result: Ericsson#580

If it helps, I'm using Outlook 365 as server.

PS: Another user (@dabhub), confirmed in the same thread that he was suffering the same problem.

Best!!

@Trim
Copy link
Member

Trim commented May 31, 2017

Hello,

The pull request of my ec-4.0 has merged some code which was in a work in progress state, so it's certainly due to that.

I've worked a bit last couple days on the edit event/item dialog and on the add attendees dialog.
What I've seen is that these 2 dialogs are trying to add overlay on the Lightening dialogs, but it clearly fails, because the ExchangeCalendar extension is not synced with Lightening.

Today I was able to adapt better the edit event/item dialog, but I can't test the edit task, because my calendar is not available in the calendar list when I use the "Add new task".

Have you made something special to be able to add task to your Exchange calendar ?
If I could add task to my calendar, it will help me to debug/fix this code.

FYI, my current work is in my wip-dialogs-event-attendees branch. In fact, the edit attendees dialog is currently not well working and the standard dialog seems to work better.

@smvicente
Copy link
Author

Hi @Trim, Thank you for looking into this!

What I have is 2 calendars linked to the same account. One is actually the calendar and the other one is linked to the "Tasks" folder when creating it. Like this:
screenshot from 2017-05-31 17 04 45

Best!

@advancingu
Copy link
Member

@Trim Anything we can do to further support you with that?

@Trim
Copy link
Member

Trim commented Jun 2, 2017

Thanks to @smvicente I'm able to use task and currently I see too a bug with the task description.

I think I'll be able to fix that point in a near future.

@smvicente
Copy link
Author

I love you guys!

@Trim
Copy link
Member

Trim commented Jun 2, 2017

Some news about my progress:

I've found that exchangecalendar has its own HTML editor implemented from the Mozilla xul editor.
Because of that, I didn't saw exceptions when setting text inside the editor.

Now, I set the text directly from the event dialog, so we see clearly exceptions when we load the window.

The exception is about setting valid XML string into the editor.innerHTML DOM element.

My current issue is that, I have this exception some times when I create a new task and some tmes I have no errors. I've tried to replace the ExchangeCalendar own function to create valid XML content from text by an implementation of "htmlspecialchars" PHP like JavaScript implementation, but it wasn't enough.

The error seems to come from the "meta" element which is not closed. I've done some tries but I wasn't able to fix this, even without content inside the "body" HTML part.

Even if I can fix that to be a bit more stable with tasks edited by our extension, we are dependent to other tasks editor as Outlook: if Outlook make some error in the XML/HTML syntax, we'll got an exception and won't be able to display the content. I think that could be a real issue and we have to find a way to have a more resilient way to (at least) display HTML code.

IIRC, Mozilla Firefox is very flexible with websites with bad code and it will be nice to be able to do same thing. Although as we set content of the editor by editing directly the "innerHTML" param we won't be able to be flexible, because the DOM code need to be correct if I think correctly.

I don't think having time this weekend to work on it. If I find some time, I'll add comments here.

@Trim
Copy link
Member

Trim commented Jun 2, 2017

Oh, and I've seen that the exchangecalendar event dialog JavaScript code remove completly the Ligthening code which load the dialog. Then it tries to load correctly the window, but it makes it a bit badder. I'm thinking about letting Lightenin to initialize the window object and then use our JavaScript to just add what we need.

For the attendees editor, the issue was excatly the same: the exchangecalendar extension have copied the code from Lightening but not completly/correctly and so it wasn't fully functional. As it didn't add Exchange specific features, I've removed this overlay to have back a good attendees dialog.

@advancingu
Copy link
Member

Regarding your second comment, I would always rely on Lightning functionality wherever possible vs. reimplemting Lightning functionality a second time. As you found out yourself with the attendees editor, reimplementing something usually leads to more bugs than using base functionality and then addition extra code on top as needed.

So, without having looked at the code myself, I would suggest you try out letting Lightning handle as much of the work as possible.

@advancingu
Copy link
Member

For the HTML exception, I would also look at having either base Thunderbird or Lightning handle what you need. If that is not possible, could you please post example HTML here which is causing issues?

@Trim
Copy link
Member

Trim commented Jun 4, 2017

Good news: I was able to avoid the HTML parsing exception by using the DOM parser and the XML Serializer for new tasks (thanks to stackoverflow as often !). I'm currently using it to convert text to HTML code (before inserting it to innerHTML).

I'm thinking now to use this code directly in the HTML editor to be always sure to insert correctly parsed content. I hope this idea will allow us to simplify the calendar-event-dialog.js code which tries to detect if current content is already HTML or not. Although, it will always convert item content to Gecko formatted HTML code that could be incompatible with exchange.

Some bad news is the HTML editor is a bit unstable: some times when I click on the editor, some buttons are in a blocked state (bold, italic, underline) and I can't type text. So it needs some more investigations.

@advancingu
Copy link
Member

@Trim Feel free to post a work in progress branch. Kick out as much code as you think makes sense. In my opinion, having a working editor is much more important than preserving fully accurate formatting for a few edge cases. If the editor doesn't work all the time you might have a callback race condition (JS !== PHP ;-) ).

@offlinehoster
Copy link

I had to add (again) the domain for my Exchange user to the plugin settings. After that a sync was fine and my events are there again.

@smvicente
Copy link
Author

smvicente commented Jun 12, 2017

Hi guys!

This starts looking good!

Just tried the last beta2, and now I'm able to uptade the description from Thunderbird:

image

But when trying to edit it, 98% of the times I open it for edition, it appears empty:

image

In any case, at least I have the feeling you are going in the right direction! thank you for all the effort!

Best.

@Trim
Copy link
Member

Trim commented Jun 12, 2017

Hello,

Indeed, I see also this bug in the HTML editor. This issue is strange, because it comes from an exception raised inside the XBL definition which try to set correctly toolbar buttons state. It fails with the numbered/ordered list, even if the task description is empty.

@advancingu
Copy link
Member

@Trim Is any of this addressed by #18 ?

@Trim
Copy link
Member

Trim commented Jun 12, 2017

No, that was another bug which didn't save the content when saving first time a new task.
That wasn't related to this issue directly, that was an error due introduced in the first merge.

@Trim
Copy link
Member

Trim commented Jun 15, 2017

Well, I didn't made any progress with this issue. That's really strange because it doesn't appear always and I don't know how to reproduce it.

I'm unable to detect from where the issue come. Here are my researches:

  • This HTML editor is a manually built using the XUL <editor> element and <toolbars> as described by Mozilla
  • It manages certain events (like click in the text area) to update either tool bar buttons state or text area
  • After some rewriting made in my wip-fix-html-editor branch, it seems that generally all code was good and no really big issue exists.
  • Some time the editor open without any issue, but some time it just doesn't work (an exception is raised and everything is blocked then)

I've used the Developer Tools to debug the issue with the "onclick" event handler and I've found that the code wasn't able to create correctly the nsICommandParams in the button state getter (which is essentially just a call to query interfaces/create instance). Without this we can't get correctly state button (and we get the exception).

The strange part is that it works well for say 5 buttons and when it tries to read the list format buttons it fails (on cmd_ol), but I don't know why. That's exactly the same tools than other like cmd_bold.

I'm afraid I can't do any thing more than suggesting the current workaround: try to open a second time the editor :-(

@smvicente
Copy link
Author

smvicente commented Jun 15, 2017

Thank you for all the effort Tim!

If it helps as a some kind of reference, I'm also using the "Provider for Google Calendar" for exactly the same thing (Calendar + Tasks), but using Google accounts instead.

In this case, the addon works well when showing/updating the task's descriptions even with the latest TB and Lightning versions. Just saying in case it helps as a reference for that part or something!

@advancingu
Copy link
Member

@Trim For troubleshooting, have you tried making certain steps (e.g. editor initialization) asynchronous using setTimeout() (assuming that exists for XUL extensions) to see if that has any effect? The symptoms you're describing really sounds like a race condition so something like the above can help narrow down the cause.

@dmrzzz
Copy link

dmrzzz commented Jun 20, 2017

I'm using 4.0.0-beta2 with TB 52.1.1, Lightning 5.4, and still having the original problem described by smvicente at the very top of this issue, although I'm concerned with calendar events as opposed to tasks (the title of this issue seems to encompass both).

I can successfully create a new calendar event with a description, but when I try to edit the description of that existing calendar event and save it again, it doesn't work; the description reverts back to the one already saved on the server.

@Trim
Copy link
Member

Trim commented Jun 21, 2017

I can successfully create a new calendar event with a description, but when I try to edit the description of that existing calendar event and save it again, it doesn't work; the description reverts back to the one already saved on the server.

Indeed, there's a known bug in 4.0beta2 if newly created events/tasks. There's a fix merged in the ec-4.0 branch about that. Maybe we should create a 4.0beta3 to have a fixed release.

@advancingu
Copy link
Member

According to @Trim, release 4.0.0-beta3 should fix this issue.

@smvicente
Copy link
Author

smvicente commented Jun 26, 2017

Hi!

Thank you for everything!

Just wanted to say that the task description issue where an update gets overwritten by the server content is indeed fixed, but when updating the description of a calendar event, the same thing still happens.

For me being able to update task's descriptions is more important, but maybe for someone else is the other way around so leaving it here just in case :)

@advancingu
Copy link
Member

Can you please open a new issue for the remaining problem? That way it gets easier to tell what still needs fixing than having one big issue for several issues, some of which have already been addressed. Thanks.

@smvicente
Copy link
Author

Of course @advancingu ! There is a new one for that in #29 :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants