Merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_undefined into lp:ubuntu-calendar-app

Proposed by Arthur Mello
Status: Merged
Approved by: Renato Araujo Oliveira Filho
Approved revision: 819
Merged at revision: 818
Proposed branch: lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_undefined
Merge into: lp:ubuntu-calendar-app
Diff against target: 152 lines (+36/-43)
3 files modified
EventBubble.qml (+3/-1)
EventDetails.qml (+27/-39)
NewEvent.qml (+6/-3)
To merge this branch: bzr merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_undefined
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Renato Araujo Oliveira Filho (community) Approve
Review via email: mp+291186@code.launchpad.net

Commit message

Use details method to get attendees list instead of "attendees" property since a binding issue was returning an empty attendees list for some use cases
Fix the attendee status on the event's details page

Description of the change

Use details method to get attendees list instead of "attendees" property since a binding issue was returning an empty attendees list for some use cases
Fix the attendee status on the event's details page

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
819. By Arthur Mello

Update comment

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

looks good.

review: Approve
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'EventBubble.qml'
--- EventBubble.qml 2016-03-31 19:19:33 +0000
+++ EventBubble.qml 2016-04-07 12:46:38 +0000
@@ -105,7 +105,9 @@
105 }105 }
106106
107 function getOwnersStatus(collection) {107 function getOwnersStatus(collection) {
108 var attendees = event.attendees;108 // Use details method to get attendees list instead of "attendees" property
109 // since a binding issue was returning an empty attendees list for some use cases
110 var attendees = event.details(Detail.EventAttendee);
109 if( attendees !== undefined ) {111 if( attendees !== undefined ) {
110 for (var j = 0 ; j < attendees.length ; ++j) {112 for (var j = 0 ; j < attendees.length ; ++j) {
111 var contact = attendees[j];113 var contact = attendees[j];
112114
=== modified file 'EventDetails.qml'
--- EventDetails.qml 2016-03-23 11:35:59 +0000
+++ EventDetails.qml 2016-04-07 12:46:38 +0000
@@ -79,7 +79,6 @@
79 if (fetchedItems.length > 0) {79 if (fetchedItems.length > 0) {
80 internal.parentEvent = fetchedItems[0];80 internal.parentEvent = fetchedItems[0];
81 updateRecurrence(internal.parentEvent);81 updateRecurrence(internal.parentEvent);
82 updateContacts(internal.parentEvent);
83 } else {82 } else {
84 console.warn("Fail to fetch pareten event")83 console.warn("Fail to fetch pareten event")
85 }84 }
@@ -103,12 +102,9 @@
103 }102 }
104103
105 function updateContacts(event) {104 function updateContacts(event) {
106 var attendees105 // Use details method to get attendees list instead of "attendees" property
107 var attendingCount, notAttendingCount106 // since a binding issue was returning an empty attendees list for some use cases
108107 var attendees = event.details(Detail.EventAttendee)
109 attendingCount = 0
110 notAttendingCount = 0
111 attendees = event.attendees
112108
113 contactModel.clear();109 contactModel.clear();
114110
@@ -116,20 +112,19 @@
116 for (var j = 0 ; j < attendees.length ; ++j) {112 for (var j = 0 ; j < attendees.length ; ++j) {
117 var name = attendees[j].name.trim().length === 0 ? attendees[j].emailAddress.replace("mailto:", "")113 var name = attendees[j].name.trim().length === 0 ? attendees[j].emailAddress.replace("mailto:", "")
118 : attendees[j].name114 : attendees[j].name
119115 var participationStatus = attendees[j].participationStatus
120 // Sort the participating guests by Attending, Not-Attending and No-Reply for easier diaply in the list view.116 if (participationStatus === EventAttendee.StatusAccepted) {
121 if(attendees[j].participationStatus === 0) {117 contactModel.append({"name": name, "participationStatus": i18n.tr("Attending")});
122 contactModel.insert(attendingCount+notAttendingCount, {"name": name,"participationStatus": attendees[j].participationStatus})118
123 notAttendingCount++119 } else if (participationStatus === EventAttendee.StatusDeclined) {
124 }120 contactModel.append({"name": name, "participationStatus": i18n.tr("Not Attending")});
125121
126 else if(attendees[j].participationStatus === 1) {122 } else if (participationStatus === EventAttendee.StatusTentative) {
127 contactModel.insert(attendingCount, {"name": name,"participationStatus": attendees[j].participationStatus})123 contactModel.append({"name": name, "participationStatus": i18n.tr("Maybe")});
128 attendingCount++124
129 }125 } else {
130126 contactModel.append({"name": name, "participationStatus": i18n.tr("No Reply")});
131 else {127
132 contactModel.append({"name": name,"participationStatus": attendees[j].participationStatus});
133 }128 }
134 }129 }
135 }130 }
@@ -355,7 +350,7 @@
355 }350 }
356 }351 }
357352
358 ListView{353 ListView {
359 model: contactModel354 model: contactModel
360 width: parent.width355 width: parent.width
361 height: count !== 0 ? (count+1) * units.gu(7): 0356 height: count !== 0 ? (count+1) * units.gu(7): 0
@@ -363,29 +358,19 @@
363358
364 section.property: "participationStatus"359 section.property: "participationStatus"
365 section.labelPositioning: ViewSection.InlineLabels360 section.labelPositioning: ViewSection.InlineLabels
366 section.delegate: ListItem {361 section.delegate: ListItem {
367 height: headerText.height + divider.height362 height: sectionLayout.height
363 divider.visible: false
368 ListItemLayout {364 ListItemLayout {
369 id: headerText365 id: sectionLayout
370 title.text: {366 title.text: section
371 if (section === "0") {
372 return i18n.tr("Not Attending")
373 }
374
375 else if (section === "1") {
376 return i18n.tr("Attending")
377 }
378
379 else if (section === "2") {
380 return i18n.tr("No Reply")
381 }
382 }
383 title.font.weight: Font.DemiBold367 title.font.weight: Font.DemiBold
384 }368 }
385 }369 }
386370
387 delegate: ListItem {371 delegate: ListItem {
388 height: contactListItemLayout.height + divider.height372 height: contactListItemLayout.height
373 divider.visible: false
389 ListItemLayout {374 ListItemLayout {
390 id: contactListItemLayout375 id: contactListItemLayout
391 title.text: name376 title.text: name
@@ -393,6 +378,9 @@
393 }378 }
394 }379 }
395380
381 // Add a ListItem to work as divider between the contact list model and the description list item
382 ListItem { height: units.gu(4) }
383
396 ListItem {384 ListItem {
397 id: descLabel385 id: descLabel
398 height: descTitle.height + desc.implicitHeight + divider.height + units.gu(4)386 height: descTitle.height + desc.implicitHeight + divider.height + units.gu(4)
399387
=== modified file 'NewEvent.qml'
--- NewEvent.qml 2016-04-05 12:36:41 +0000
+++ NewEvent.qml 2016-04-07 12:46:38 +0000
@@ -160,9 +160,12 @@
160 var index = 0;160 var index = 0;
161161
162 if( e.itemType === Type.Event ) {162 if( e.itemType === Type.Event ) {
163 if(e.attendees){163 // Use details method to get attendees list instead of "attendees" property
164 for( var j = 0 ; j < e.attendees.length ; ++j ) {164 // since a binding issue was returning an empty attendees list for some use cases
165 contactModel.append({"contact": e.attendees[j]});165 var attendees = e.details(Detail.EventAttendee);
166 if(attendees){
167 for( var j = 0 ; j < attendees.length ; ++j ) {
168 contactModel.append({"contact": attendees[j]});
166 }169 }
167 }170 }
168 }171 }

Subscribers

People subscribed via source and target branches

to status/vote changes: