@@ -377,7 +377,7 @@ public void onResponse(JSONObject response) {
377
377
}
378
378
}, errorListener );
379
379
380
- request .addCredential (staff_email_address , api_token );
380
+ request .addCredential (user . getEmail () , api_token );
381
381
request .setTag (cancelTag );
382
382
request .setRetryPolicy (new DefaultRetryPolicy (ZendeskJsonObjectRequest .TIMEOUT_MS ,
383
383
ZendeskJsonObjectRequest .MAX_RETRIES , ZendeskJsonObjectRequest .BACKOFF_MULT ));
@@ -462,7 +462,7 @@ private HSTicketUpdate retrieveTicketUpdate(JSONObject updateObject, JSONArray u
462
462
JSONArray eventsArray = updateObject .getJSONArray ("events" );
463
463
464
464
int eventsArrayLength = eventsArray .length ();
465
- for (int i = 0 ; i < eventsArrayLength ; i ++) {
465
+ for (int i = 0 ; i < eventsArrayLength ; i ++) { //else Nothing
466
466
JSONObject eventObject = eventsArray .getJSONObject (i );
467
467
if (eventObject .getString ("type" ).equals ("Comment" )) {
468
468
@@ -480,19 +480,23 @@ private HSTicketUpdate retrieveTicketUpdate(JSONObject updateObject, JSONArray u
480
480
// authorId can be null here because of previous if loop. Make sure to handle it properly
481
481
JSONObject author = searchForUser (authorId , usersArray );
482
482
483
- if (!author .isNull ("name" )) {
484
- from = author .getString ("name" );
483
+ if (author != null ) {
484
+ if (!author .isNull ("name" )) {
485
+ from = author .getString ("name" );
486
+ }
487
+
488
+ String role = author .getString ("role" );
489
+ if (role .equals ("end-user" )) {
490
+ isUpdateTypeUserReply = true ;
491
+ }
485
492
}
493
+
494
+
486
495
487
496
if (!updateObject .isNull ("created_at" )) {
488
497
update_time = parseTime (updateObject .getString ("created_at" ));
489
498
}
490
499
491
- String role = author .getString ("role" );
492
- if (role .equals ("end-user" )) {
493
- isUpdateTypeUserReply = true ;
494
- }
495
-
496
500
JSONArray attachmentObjects = eventObject .getJSONArray ("attachments" );
497
501
if (attachmentObjects != null ) {
498
502
int length = attachmentObjects .length ();
@@ -508,6 +512,9 @@ private HSTicketUpdate retrieveTicketUpdate(JSONObject updateObject, JSONArray u
508
512
}
509
513
attachments = attachmentArray .toArray (new HSAttachment [length ]);
510
514
}
515
+
516
+
517
+ break ;
511
518
}
512
519
}
513
520
@@ -562,7 +569,7 @@ private JSONObject searchForUser(int userId, JSONArray usersArray) throws JSONEx
562
569
}
563
570
}
564
571
565
- return usersObject ;
572
+ return null ;
566
573
}
567
574
568
575
private void showArticlesInSection (String cancelTag , String section_id , RequestQueue queue , final OnFetchedArraySuccessListener successListener , final ErrorListener errorListener ) {
0 commit comments