@@ -17,18 +17,7 @@ asanaModule.service("AsanaGateway", ["$http", "AsanaConstants", "$q", "$filter",
1717 options . query = { opt_fields : "name,email,photo" } ;
1818
1919 return AsanaGateway . api ( options ) . then ( function ( response ) {
20- response . forEach ( function ( user ) {
21- if ( user . photo == null ) {
22- user . photo = {
23- "image_21x21" : "../img/nopicture.png" ,
24- "image_27x27" : "../img/nopicture.png" ,
25- "image_36x36" : "../img/nopicture.png" ,
26- "image_60x60" : "../img/nopicture.png" ,
27- "image_128x128" : "../img/nopicture.png" ,
28- "image_1024x1024" : "../img/nopicture.png"
29- } ;
30- }
31- } ) ;
20+ AsanaConstants . setDefaultPicture ( response ) ;
3221 return response ;
3322 } ) ;
3423 } ;
@@ -99,6 +88,9 @@ asanaModule.service("AsanaGateway", ["$http", "AsanaConstants", "$q", "$filter",
9988 var now = new Date ( ) . getTime ( ) ; // current time since epoch seconds
10089 return AsanaGateway . api ( options ) . then ( function ( response ) {
10190 response . forEach ( function ( element ) {
91+ if ( element . assignee != null ) {
92+ AsanaConstants . setDefaultPictureUser ( element . assignee ) ;
93+ }
10294 if ( element . due_at !== null ) {
10395 element . due = Date . parse ( element . due_at ) ;
10496 element . schedule = $filter ( 'date' ) ( new Date ( element . due ) , 'MMM d hh:mm a' ) ;
@@ -123,7 +115,11 @@ asanaModule.service("AsanaGateway", ["$http", "AsanaConstants", "$q", "$filter",
123115 options . query = {
124116 opt_fields : "assignee.name,assignee.photo,assignee_status,completed,completed_at,created_at,due_at,due_on,followers.name,hearted,hearts,memberships,modified_at,name,notes,num_hearts,projects.name,tags.name,workspace.name"
125117 } ;
126- return AsanaGateway . api ( options ) ;
118+ return AsanaGateway . api ( options ) . then ( function ( task ) {
119+ AsanaConstants . setDefaultPictureUser ( task . assignee ) ;
120+ AsanaConstants . setDefaultPicture ( task . followers ) ;
121+ return task ;
122+ } ) ;
127123 } ;
128124
129125 AsanaGateway . taskDone = function ( options ) {
@@ -142,7 +138,12 @@ asanaModule.service("AsanaGateway", ["$http", "AsanaConstants", "$q", "$filter",
142138 opt_fields : "type,text,created_at,created_by.name,created_by.email,created_by.photo.image_36x36"
143139 } ;
144140
145- return AsanaGateway . api ( options ) ;
141+ return AsanaGateway . api ( options ) . then ( function ( stories ) {
142+ stories . forEach ( function ( story ) {
143+ AsanaConstants . setDefaultPictureUser ( story . created_by ) ;
144+ } ) ;
145+ return stories ;
146+ } ) ;
146147 } ;
147148
148149 AsanaGateway . addComment = function ( options ) {
0 commit comments