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
1=== modified file 'EventBubble.qml'
2--- EventBubble.qml 2016-03-31 19:19:33 +0000
3+++ EventBubble.qml 2016-04-07 12:46:38 +0000
4@@ -105,7 +105,9 @@
5 }
6
7 function getOwnersStatus(collection) {
8- var attendees = event.attendees;
9+ // Use details method to get attendees list instead of "attendees" property
10+ // since a binding issue was returning an empty attendees list for some use cases
11+ var attendees = event.details(Detail.EventAttendee);
12 if( attendees !== undefined ) {
13 for (var j = 0 ; j < attendees.length ; ++j) {
14 var contact = attendees[j];
15
16=== modified file 'EventDetails.qml'
17--- EventDetails.qml 2016-03-23 11:35:59 +0000
18+++ EventDetails.qml 2016-04-07 12:46:38 +0000
19@@ -79,7 +79,6 @@
20 if (fetchedItems.length > 0) {
21 internal.parentEvent = fetchedItems[0];
22 updateRecurrence(internal.parentEvent);
23- updateContacts(internal.parentEvent);
24 } else {
25 console.warn("Fail to fetch pareten event")
26 }
27@@ -103,12 +102,9 @@
28 }
29
30 function updateContacts(event) {
31- var attendees
32- var attendingCount, notAttendingCount
33-
34- attendingCount = 0
35- notAttendingCount = 0
36- attendees = event.attendees
37+ // Use details method to get attendees list instead of "attendees" property
38+ // since a binding issue was returning an empty attendees list for some use cases
39+ var attendees = event.details(Detail.EventAttendee)
40
41 contactModel.clear();
42
43@@ -116,20 +112,19 @@
44 for (var j = 0 ; j < attendees.length ; ++j) {
45 var name = attendees[j].name.trim().length === 0 ? attendees[j].emailAddress.replace("mailto:", "")
46 : attendees[j].name
47-
48- // Sort the participating guests by Attending, Not-Attending and No-Reply for easier diaply in the list view.
49- if(attendees[j].participationStatus === 0) {
50- contactModel.insert(attendingCount+notAttendingCount, {"name": name,"participationStatus": attendees[j].participationStatus})
51- notAttendingCount++
52- }
53-
54- else if(attendees[j].participationStatus === 1) {
55- contactModel.insert(attendingCount, {"name": name,"participationStatus": attendees[j].participationStatus})
56- attendingCount++
57- }
58-
59- else {
60- contactModel.append({"name": name,"participationStatus": attendees[j].participationStatus});
61+ var participationStatus = attendees[j].participationStatus
62+ if (participationStatus === EventAttendee.StatusAccepted) {
63+ contactModel.append({"name": name, "participationStatus": i18n.tr("Attending")});
64+
65+ } else if (participationStatus === EventAttendee.StatusDeclined) {
66+ contactModel.append({"name": name, "participationStatus": i18n.tr("Not Attending")});
67+
68+ } else if (participationStatus === EventAttendee.StatusTentative) {
69+ contactModel.append({"name": name, "participationStatus": i18n.tr("Maybe")});
70+
71+ } else {
72+ contactModel.append({"name": name, "participationStatus": i18n.tr("No Reply")});
73+
74 }
75 }
76 }
77@@ -355,7 +350,7 @@
78 }
79 }
80
81- ListView{
82+ ListView {
83 model: contactModel
84 width: parent.width
85 height: count !== 0 ? (count+1) * units.gu(7): 0
86@@ -363,29 +358,19 @@
87
88 section.property: "participationStatus"
89 section.labelPositioning: ViewSection.InlineLabels
90- section.delegate: ListItem {
91- height: headerText.height + divider.height
92+ section.delegate: ListItem {
93+ height: sectionLayout.height
94+ divider.visible: false
95 ListItemLayout {
96- id: headerText
97- title.text: {
98- if (section === "0") {
99- return i18n.tr("Not Attending")
100- }
101-
102- else if (section === "1") {
103- return i18n.tr("Attending")
104- }
105-
106- else if (section === "2") {
107- return i18n.tr("No Reply")
108- }
109- }
110+ id: sectionLayout
111+ title.text: section
112 title.font.weight: Font.DemiBold
113 }
114 }
115
116 delegate: ListItem {
117- height: contactListItemLayout.height + divider.height
118+ height: contactListItemLayout.height
119+ divider.visible: false
120 ListItemLayout {
121 id: contactListItemLayout
122 title.text: name
123@@ -393,6 +378,9 @@
124 }
125 }
126
127+ // Add a ListItem to work as divider between the contact list model and the description list item
128+ ListItem { height: units.gu(4) }
129+
130 ListItem {
131 id: descLabel
132 height: descTitle.height + desc.implicitHeight + divider.height + units.gu(4)
133
134=== modified file 'NewEvent.qml'
135--- NewEvent.qml 2016-04-05 12:36:41 +0000
136+++ NewEvent.qml 2016-04-07 12:46:38 +0000
137@@ -160,9 +160,12 @@
138 var index = 0;
139
140 if( e.itemType === Type.Event ) {
141- if(e.attendees){
142- for( var j = 0 ; j < e.attendees.length ; ++j ) {
143- contactModel.append({"contact": e.attendees[j]});
144+ // Use details method to get attendees list instead of "attendees" property
145+ // since a binding issue was returning an empty attendees list for some use cases
146+ var attendees = e.details(Detail.EventAttendee);
147+ if(attendees){
148+ for( var j = 0 ; j < attendees.length ; ++j ) {
149+ contactModel.append({"contact": attendees[j]});
150 }
151 }
152 }

Subscribers

People subscribed via source and target branches

to status/vote changes: