diff --git a/iNaturalist/src/main/java/org/inaturalist/android/CommentsIdsAdapter.java b/iNaturalist/src/main/java/org/inaturalist/android/CommentsIdsAdapter.java index 4c9fb99c..75a835ad 100644 --- a/iNaturalist/src/main/java/org/inaturalist/android/CommentsIdsAdapter.java +++ b/iNaturalist/src/main/java/org/inaturalist/android/CommentsIdsAdapter.java @@ -542,10 +542,20 @@ public static String formatIdDate(Context context, Timestamp postDate, BetterJSO // Only show month/year for observations that you don't own + obscured/private INaturalistApp app = (INaturalistApp) context.getApplicationContext(); String currentUser = app.currentUserLogin(); + String obsUser = null; + + if (observation != null) { + if (observation.getJSONObject("user") != null && + observation.getJSONObject("user").has("login")) { + obsUser = observation.getJSONObject("user").optString("login"); + } else { + obsUser = observation.getString("user_login"); + } + } boolean obsByUser = observation != null && currentUser != null && - observation.getJSONObject("user") != null && - observation.getJSONObject("user").optString("login", "").equals(currentUser); + obsUser != null && + obsUser.equals(currentUser); boolean isPrivateOrObscured = false; if (observation != null) { diff --git a/iNaturalist/src/main/java/org/inaturalist/android/ObservationViewerFragment.java b/iNaturalist/src/main/java/org/inaturalist/android/ObservationViewerFragment.java index 18fb2d8e..ced70fa2 100644 --- a/iNaturalist/src/main/java/org/inaturalist/android/ObservationViewerFragment.java +++ b/iNaturalist/src/main/java/org/inaturalist/android/ObservationViewerFragment.java @@ -1212,7 +1212,8 @@ private void refreshFavorites() { mRemoveFavorite.setVisibility(View.GONE); } - mFavoritesAdapter = new FavoritesAdapter(getActivity(), mFavorites, new BetterJSONObject(mObsJson)); + mFavoritesAdapter = new FavoritesAdapter(getActivity(), mFavorites, + mObsJson != null ? new BetterJSONObject(mObsJson) : new BetterJSONObject(mObservation.toJSONObject())); mFavoritesList.setAdapter(mFavoritesAdapter); mRemoveFavorite.setOnClickListener(new OnClickListener() {