Skip to content

Commit 14e5a64

Browse files
committed
[Bug Fix] ignoring private notes in HappyFox hear
1 parent 0c7882a commit 14e5a64

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

helpstack/src/com/tenmiles/helpstack/gears/HSHappyfoxGear.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ public void onResponse(JSONObject response) {
255255
JSONObject updateObject = updateArray.getJSONObject(i);
256256

257257
if (!updateObject.isNull("message")) {
258-
ticketUpdates.add(parseTicketUpdateFromJson(updateObject));
258+
HSTicketUpdate update = parseTicketUpdateFromJson(updateObject);
259+
if (update != null) {
260+
ticketUpdates.add(update);
261+
}
259262
}
260263
}
261264

@@ -313,6 +316,10 @@ public void onResponse(JSONObject response) {
313316

314317
update = parseTicketUpdateFromJson(updateObject);
315318

319+
if (update == null) {
320+
continue;
321+
}
322+
316323
break;
317324
}
318325

@@ -384,10 +391,28 @@ private HSKBItem[] getSectionsFromData(JSONArray sectionsArray) {
384391
return array;
385392
}
386393

394+
395+
/**
396+
*
397+
* @param updateObject, can be null if it is private note
398+
* @return
399+
* @throws JSONException
400+
*/
387401
private HSTicketUpdate parseTicketUpdateFromJson(JSONObject updateObject) throws JSONException {
388402
String updateId = null;
389403
String userName = null;
390404

405+
if (updateObject.isNull("message")) {
406+
return null;
407+
}
408+
409+
JSONObject messageObject = updateObject.getJSONObject("message");
410+
411+
// private note
412+
if (!messageObject.isNull("message_type") && messageObject.getString("message_type").equals("p")) {
413+
return null;
414+
}
415+
391416
JSONObject byObject = updateObject.getJSONObject("by");
392417
if (!byObject.isNull("name")) {
393418
userName = updateObject.getJSONObject("by").getString("name");

0 commit comments

Comments
 (0)