Closed Bug 409968 Opened 17 years ago Closed 17 years ago

Modifying all items of a recurring event runs into exceptions

Categories

(Calendar :: Lightning Only, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: dbo, Assigned: berend.cornelius09)

References

Details

Attachments

(1 file, 1 obsolete file)

Error: rangeStart has no properties
Source File: file:///d:/moz18/sbird-debug/dist/xpi-stage/lightning/js/calRecurrenceInfo.js
Line: 351

Caused by:

 // get all sub items if it is a recurring item
 -  647     var occs = item.getOccurrencesBetween(this.agendaListbox.getStart(),
 -  648                                           this.agendaListbox.getEnd(), {});
 -  649     occs.forEach(isSelected = this.agendaListbox.deleteItem, this.agendaListbox);
 -  650     return isSelected;

=> getOccurrencesBetween(null, null, ...) is called.
Flags: blocking-calendar0.8+
I need to switch collapse/uncollapse the today pane ranges, e.g. "Today" once to get those errors in the js console.
Flags: blocking-calendar0.8+
Flags: blocking-calendar0.8+
Component: General → Lightning Only
QA Contact: general → lightning
Attached patch patch v.1 (obsolete) — — Splinter Review
When the items are modified within the calendar view with agenda period being open  the code runs into a null pointer exception.
Assignee: nobody → Berend.Cornelius
Status: NEW → ASSIGNED
Attachment #295753 - Flags: review?
Comment on attachment 295753 [details] [diff] [review]
patch v.1

Fix year. r=philipp
Attachment #295753 - Flags: review? → review+
Comment on attachment 295753 [details] [diff] [review]
patch v.1

Philipp granted review, but I have some obvious style nits, especially camelCase capitalization of function and variable names all over agenda-listbox.js.

>Index: lightning/content/agenda-listbox.js

>- * The Original Code is Lightning code.
>+    - The Original Code is Sun Microsystems code.

This is mixed comment style.


>  *
>- * The Initial Developer of the Original Code is Oracle Corporation
>+ * The Initial Developer of the Original Code is Sun Microsystems.

According to http://www.mozilla.org/MPL/boilerplate-1.1/mpl-tri-license-c this should be two lines, and if you remove the contributors update the copyright year to 2007 (when the code was rewritten).


>@@ -334,18 +325,19 @@ function getlistItems(aItem, aPeriod) {

This function should be named "getListItems" (camelCase capitalization!).


> agendaListbox.deleteItem =
> function deleteItem(aItem) {
>     var isSelected = false;
>     var listItems = this.getlistItems(aItem);
>     if (listItems.length > 0) {
>         for (var i = listItems.length - 1; i >= 0; i--) {
>             var listItem = listItems[i];
>-            isSelected = listItem.selected;
>-            if (isSelected) {
>+            var lisSelected = listItem.selected;
>+            if (lisSelected) {
>+                isSelected = true;
>                 this.moveSelection();
>             }

Why do we need this new variable lisSelected (which name I don't understand)? What is the difference between isSelected and lisSelected? I don't like the naming conventions you follow. I prefer more meaningful names, so you understand their purpose without knowing the complete flow of the function.

>@@ -557,16 +549,32 @@ function removelistItems() {

This function should be named "removeListItems" (camelCase capitalization!).


>+agendaListbox.getlistItemByhashId =

This function should be named "getListItemByHashId" (camelCase capitalization!).


> agendaListbox.calendarObserver.onLocalDeleteItem =
[...]
>+    var SelectedItemhashId = -1;

Variable names should start with a lowercase letter.


> agendaListbox.calendarObserver.onModifyItem =
[...]
>+    var SelectedItemhashId = this.onLocalDeleteItem(oldItem);

Variable names should start with a lowercase letter.


>Index: lightning/content/agenda-listbox.xml

>-   - The Initial Developer of the Original Code is
>-   -   Mozilla Corp
>+   - The Initial Developer of the Original Code is Sun Microsystems.

According to http://www.mozilla.org/MPL/boilerplate-1.1/mpl-tri-license-html this should be two lines.
Good stuff Martin!

Berend, please only commit once you have adressed Martin's comments.
>This function should be named "removeListItems" (camelCase capitalization!).
...
>This function should be named "getListItems" (camelCase capitalization!).
Basically I did not forget about Camel capitalization in my file. I just found it more appropriate to denote the name of the functions to the name of the common variable names like "listItem" or "hashId", that's why I used names like "getlistItem()" and "getlistItemByhashId". I will change that throughout the file.

>This is mixed comment style.
One of the files is an xml file where comments are wrapped in "<!-- ... -->".

>Why do we need this new variable lisSelected ...
The variable is necessary as within recurring events I just want to get to know if any item within the series is selected or not. Without this the variable would possibly be overwritten by the next unselected item state in the series. I will change the name to isSelected2. "l" was supposed to denote the more inner scope of the variable within the loop compared to "isSelected"
Attached patch patch v. 2 — — Splinter Review
final patch that I checked in
Attachment #295753 - Attachment is obsolete: true
patch check in on trunk and MOZILLA_1_8_BRANCH
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Target Milestone: --- → 0.8
checked in lightning build 2008011003 -> task is fixed and verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: