From b102deaee11572bebb7a5780359e6626434b6386 Mon Sep 17 00:00:00 2001 From: sk Date: Sun, 4 Jun 2023 19:08:18 +0200 Subject: [PATCH] don't let interaction counts go negative --- .../joinmastodon/android/api/StatusInteractionController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/StatusInteractionController.java b/mastodon/src/main/java/org/joinmastodon/android/api/StatusInteractionController.java index ec45b6d90..8baabf20a 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/StatusInteractionController.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/StatusInteractionController.java @@ -46,7 +46,7 @@ public class StatusInteractionController{ @Override public void onSuccess(Status result){ runningFavoriteRequests.remove(status.id); - result.favouritesCount = Math.max(0, status.favouritesCount) + (favorited ? 1 : -1); + result.favouritesCount = Math.max(0, status.favouritesCount + (favorited ? 1 : -1)); cb.accept(result); if (updateCounters) E.post(new StatusCountersUpdatedEvent(result)); } @@ -80,7 +80,7 @@ public class StatusInteractionController{ public void onSuccess(Status reblog){ Status result = reblog.getContentStatus(); runningReblogRequests.remove(status.id); - result.reblogsCount = Math.max(0, status.reblogsCount) + (reblogged ? 1 : -1); + result.reblogsCount = Math.max(0, status.reblogsCount + (reblogged ? 1 : -1)); cb.accept(result); if (updateCounters) E.post(new StatusCountersUpdatedEvent(result)); }