Last Comment Bug 1187741 - VTODO only calendar disables "add as task" button
: VTODO only calendar disables "add as task" button
Status: RESOLVED FIXED
:
Product: Calendar
Classification: Client Software
Component: Tasks (show other bugs)
: Lightning 4.0.1.2
: Unspecified Unspecified
-- normal (vote)
: 4.0.2.1
Assigned To: Merike Sell (:merike)
:
:
Mentors:
Depends on:
Blocks: ltn4021
  Show dependency treegraph
 
Reported: 2015-07-26 14:40 PDT by tk1
Modified: 2015-08-26 06:17 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
bug1187741 (2.76 KB, patch)
2015-08-01 10:02 PDT, Merike Sell (:merike)
philipp: review+
Details | Diff | Splinter Review
bug1187741 v2 (2.74 KB, patch)
2015-08-06 13:27 PDT, Merike Sell (:merike)
merikes.lists: review+
philipp: approval‑calendar‑beta+
philipp: approval‑calendar‑esr+
Details | Diff | Splinter Review

Description User image tk1 2015-07-26 14:40:57 PDT
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Build ID: 20150630154324

Steps to reproduce:

- Only have the Tasks view on a Zarafa Calendar integrated (https://<server>:8443/caldav/<username>/Tasks
- type: caldav
- Don't have any other calender integrated


Actual results:

- Button "Add as task" grayed out
- However, manually adding a task works fine (task synchronized with server)


Expected results:

Only the "add as event" button should be grayed out.

Errors seems to be in calendar-extract.js:
        if (newEvent.getAttribute("disabled") == "true") {
//            buttonsDisabled = true;
//            contextDisabled = true;
        }

Not fully understanding the details, this seems as if the possibility that (only a new task can be created but no new event) has not been foreseen. Commenting out these two lines enables both buttons (NB: workaround, as "add as event" button should still be grayed out) again and results in a working "add as task" dialog.
Comment 1 User image [:MakeMyDay] 2015-07-27 09:56:09 PDT
Are both, add new event and add new task buttons disabled or just the task button? What do you mean by adding manually?

Can you please enable calendar.debug.log and calendar.debug.log.verbose in the config editor and check the error console (ctrl+shift+j) after a restart of TB? The server should advertise its capabilities. Can you post the respective messages here? Also, please check for other suspicious messages.
Comment 2 User image tk1 2015-07-27 13:09:01 PDT
Thanks for looking into this!

Yes, both buttons are disabled. To prevent a potential misunderstanding: I do not refer to "new event" or "new task", but "add as event" and "add as task"

Sorry, what I mean is: when I go to "Events and Tasks" in the menu bar, "new event" is (rightly) grayed out, but "new task" is not and works perfectly.
==> That's why I came to the conclusion that the server rightly advertises its capabilities but the mentioned code in the first post causes the 'trouble'.

Debug messages below. Nothing suspicious to be found...

CalDAV: Calendar <name> generally supports calendar-schedule
CalDAV: DAV header: 1, access-control, calendar-access, calendar-schedule, calendarserver-principal-property-search
CalDAV: send: OPTIONS https://<URL>
CalDAV: Authentication scheme for fook is Basic
CalDAV: Found principal url from DAV:current-user-principal /caldav/<user>/
Adding supported items: VTODO for calendar: <name>
Comment 3 User image [:MakeMyDay] 2015-07-28 12:50:45 PDT
Merike, this is also releated to the extractor - can you talke a look at it?
Comment 4 User image Merike Sell (:merike) 2015-07-30 02:37:02 PDT
I think the first comment is correct here, tasks only calendars are not considered in code when disabling extraction and therefore both options get disabled even if one should remain available. I'll take a look at it later today or tomorrow.

Meanwhile it would be helpful to know what is the easiest way to set up a tasks only or events only calendar? This way I can test both scenarios properly later on.
Comment 5 User image [:MakeMyDay] 2015-07-30 03:04:08 PDT
> Meanwhile it would be helpful to know what is the easiest way to set up a
> tasks only or events only calendar? This way I can test both scenarios
> properly later on.

You will probably need a caldav calender serverside configured for task only. Eventually Google also supports this, but I'm not sure.
Comment 6 User image tk1 2015-07-30 03:16:11 PDT
Maybe not the nicest way, but tweaking calDavCalendar.js might be an option (if no serverside solution is available). Also happy to test code for VTODO-only situation.

calDavCalendar.js, removing the VEVENT capability from mSupportedItemTypes:

            let supportedComponents = caldavXPath(multistatus,
                "/D:multistatus/D:response/D:propstat/D:prop/C:supported-calendar-component-set/C:comp/@*[local-name()='name']");
            if (supportedComponents && supportedComponents.length) {
                thisCalendar.mSupportedItemTypes = [ compName
                    for each (compName in supportedComponents)
                    if (thisCalendar.mGenerallySupportedItemTypes.indexOf(compName) >= 0)
                ];
                cal.LOG("Adding supported items: " + thisCalendar.mSupportedItemTypes.join(",") + " for calendar: " + thisCalendar.name);
            }
Comment 7 User image Merike Sell (:merike) 2015-08-01 10:02:27 PDT
Created attachment 8642061 [details] [diff] [review]
bug1187741

Not fully tested yet, but this should work better for tasks only calendars.
Comment 8 User image Merike Sell (:merike) 2015-08-05 12:58:05 PDT
(In reply to tk1 from comment #6)
> Maybe not the nicest way, but tweaking calDavCalendar.js might be an option
> (if no serverside solution is available). Also happy to test code for
> VTODO-only situation.
> 
> calDavCalendar.js, removing the VEVENT capability from mSupportedItemTypes:

That's an useful trick! I tried out with Google calendar and with the patch applied it properly enables only events now. Previously task buttons and context menu entry were enabled for conversion too although it didn't work if this was the only calendar available. After changing the calendar to support only tasks the opposite case seemed to work well too.

So hopefully it will work for you too.
Comment 9 User image Philipp Kewisch [:Fallen] 2015-08-06 01:37:27 PDT
Comment on attachment 8642061 [details] [diff] [review]
bug1187741

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

Looks good, r=philipp.
Comment 10 User image [:MakeMyDay] 2015-08-06 08:14:46 PDT
Merike, is this fully tested so we can consider this for 4.0.2, too (eventually without having this on cc first)?
Comment 11 User image Merike Sell (:merike) 2015-08-06 13:27:23 PDT
Created attachment 8644556 [details] [diff] [review]
bug1187741 v2

This fixes missing semicolons and an issue with re-enabling context menu after both options have been disabled.

It could be considered for next release but can also wait for next one if this seems too risky without wider testing.
Comment 12 User image tk1 2015-08-08 13:24:18 PDT
Happy to confirm that the patch works for me (calendar in task only setup):
- "add as event" button is disabled
- "add as task" button is enabled, starts the dialogue and task is added

Thanks a lot Merike!
Comment 13 User image Merike Sell (:merike) 2015-08-09 12:31:15 PDT
In any case let's start with comm-central :)
Comment 14 User image aleth [:aleth] 2015-08-09 15:37:50 PDT
url:        https://hg.mozilla.org/comm-central/rev/fbc2a9c68d93a89fb49f9611cb9db4f328853f27
changeset:  fbc2a9c68d93a89fb49f9611cb9db4f328853f27
user:       Merike Sell <merike.sell@eesti.ee>
date:       Thu Aug 06 13:27:00 2015 +0200
description:
Bug 1187741 - VTODO only calendar disables "add as task" button. r=philipp
Comment 15 User image Merike Sell (:merike) 2015-08-25 13:46:29 PDT
Comment on attachment 8644556 [details] [diff] [review]
bug1187741 v2

This moved to aurora meanwhile and I haven't heard of any issues. Although according to AMO almost nobody uses nightlies and aurora builds?

Could this be considered for 4.0.3 as well? If not for release then when is next beta release planned?
Comment 16 User image Stefan Sitter 2015-08-25 13:56:47 PDT
The statics on AMO only tell what system have checked for Lightning updates at AMO. Lightning comm-central and comm-aurora builds don't use AMO for updates therefore you don't see them in the AMO statistics. Same is true for many Linux distributions that install Lightning from its own repositories instead of AMO.
Comment 17 User image Philipp Kewisch [:Fallen] 2015-08-25 14:54:42 PDT
Comment on attachment 8644556 [details] [diff] [review]
bug1187741 v2

4.0.3 is fine for me. Beta is coming up this or next week.
Comment 18 User image Philipp Kewisch [:Fallen] 2015-08-26 06:13:41 PDT
Backported to releases/comm-beta changeset 422323c3e92f
Comment 19 User image Philipp Kewisch [:Fallen] 2015-08-26 06:17:13 PDT
Backported to releases/comm-esr38 changeset 9bb11bb336cc

Note You need to log in before you can comment on or make changes to this bug.