Closed Bug 653924 Opened 9 years ago Closed 9 years ago

RELATED-TO headers are duplicated during write

Categories

(Calendar :: Provider: ICS/WebDAV, defect)

Lightning 1.0b2
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bugzilla, Assigned: Fallen)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: Lightning 1.0b2

Lightning is duplicating RELATED-TO properties during write, it makes it unusable for using with other calendar apps which can handle relations.

Reproducible: Always

Steps to Reproduce:
1. Create ics file with two tasks or events
2. Manually (text-editor or third-party app) create a relation between those two items using RELATED-TO property
3. Open this ics with lightning
4. Do any changes to calendar
5. Review the file; RELATED-TO properties will be duplicated

Actual Results:  
test.ics contains duplicated related-to properties

BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
VERSION:2.0
X-WR-CALNAME:test
X-WR-TIMEZONE:Europe/Warsaw
BEGIN:VTODO
CREATED:20110430T150942Z
LAST-MODIFIED:20110430T151059Z
DTSTAMP:20110430T151059Z
UID:2424d594-0453-49a1-b842-6faee483ca78
SUMMARY:1
SEQUENCE:4
X-MOZ-GENERATION:4
END:VTODO
BEGIN:VTODO
CREATED:20110430T150947Z
LAST-MODIFIED:20110430T150949Z
DTSTAMP:20110430T150949Z
UID:7a67183e-4c29-4e72-9437-2077050025bc
SUMMARY:2
RELATED-TO:2424d594-0453-49a1-b842-6faee483ca78
RELATED-TO:2424d594-0453-49a1-b842-6faee483ca78
END:VTODO
END:VCALENDAR


Expected Results:  
BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
VERSION:2.0
X-WR-CALNAME:test
X-WR-TIMEZONE:Europe/Warsaw
BEGIN:VTODO
CREATED:20110430T150942Z
LAST-MODIFIED:20110430T151059Z
DTSTAMP:20110430T151059Z
UID:2424d594-0453-49a1-b842-6faee483ca78
SUMMARY:1
SEQUENCE:4
X-MOZ-GENERATION:4
END:VTODO
BEGIN:VTODO
CREATED:20110430T150947Z
LAST-MODIFIED:20110430T150949Z
DTSTAMP:20110430T150949Z
UID:7a67183e-4c29-4e72-9437-2077050025bc
SUMMARY:2
RELATED-TO:2424d594-0453-49a1-b842-6faee483ca78
END:VTODO
END:VCALENDAR

Lightning is writing each relation two times: 
one time in calItemBase:
  for each (let relation in this.getRelations({})) {
    icalcomp.addProperty(relation.icalProperty);
  }

and the second time in calTodo and calEvent in get icalComponent() (because it's returned by propertyEnumerator)

Possible solutions: 
1. remove saving relations from calItemBase
2. OR change get icalComponent of calTodo and calEvent to ignore related-to properties
3. OR change propertyEnumerator to not return related-to properties

After you decide which way to go I can provide a patch. Solution 1 and 2 looks most reasonable for me, 3 would change behaviour of propertyEnumerator which could harm other parts of code.
Version: unspecified → Lightning 1.0b2
OS: Windows 7 → All
Hardware: x86 → All
It might be enough to add RELATED-TO calItemBase's itemBasePromotedProps hashmap. This matches most with option 2.

I would appreciate a patch and testing. When you upload please set review to ? and then enter :Fallen in the field that shows up.
Assignee: nobody → bugzilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Kacper could you provide a patch for this?
Attached patch Fix - v1Splinter Review
r=me, this patch does work. Testcase included
Assignee: bugzilla → philipp
Attachment #567622 - Flags: review+
Pushed to comm-central <http://hg.mozilla.org/comm-central/rev/2fbfb9106027>
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Trunk
Backported to comm-aurora <http://hg.mozilla.org/releases/comm-aurora/rev/08f790ef4c4a>
Target Milestone: Trunk → 1.0b9
Backported to comm-beta <http://hg.mozilla.org/releases/comm-beta/rev/745b964e0141>
Target Milestone: 1.0b9 → 1.0b8
You need to log in before you can comment on or make changes to this bug.