diff --git a/mastodon/src/main/java/org/joinmastodon/android/model/Status.java b/mastodon/src/main/java/org/joinmastodon/android/model/Status.java index c1e901334..9ce3a174d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/model/Status.java +++ b/mastodon/src/main/java/org/joinmastodon/android/model/Status.java @@ -14,6 +14,7 @@ import com.google.gson.JsonParseException; import org.joinmastodon.android.GlobalUserPreferences; import org.joinmastodon.android.api.ObjectValidationException; import org.joinmastodon.android.api.RequiredField; +import org.joinmastodon.android.api.session.AccountSessionManager; import org.joinmastodon.android.events.StatusCountersUpdatedEvent; import org.joinmastodon.android.ui.text.HtmlParser; import org.parceler.Parcel; @@ -171,6 +172,11 @@ public class Status extends BaseModel implements DisplayItemsParent, Searchable{ return strippedText; } + public boolean canBeBoosted(String accountID){ + return (visibility==StatusPrivacy.PUBLIC || visibility==StatusPrivacy.UNLISTED || visibility==StatusPrivacy.LOCAL + || (visibility==StatusPrivacy.PRIVATE && account.id.equals(AccountSessionManager.getInstance().getAccount(accountID).self.id))); + } + public static Status ofFake(String id, String text, Instant createdAt) { Status s = new Status(); s.id = id; diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java index ba4db0ea2..1bbcb1713 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java @@ -152,8 +152,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ boost.setSelected(item.status.reblogged); favorite.setSelected(item.status.favourited); bookmark.setSelected(item.status.bookmarked); - boost.setEnabled(item.status.visibility==StatusPrivacy.PUBLIC || item.status.visibility==StatusPrivacy.UNLISTED || item.status.visibility==StatusPrivacy.LOCAL - || (item.status.visibility==StatusPrivacy.PRIVATE && item.status.account.id.equals(AccountSessionManager.getInstance().getAccount(item.accountID).self.id))); + boost.setEnabled(item.status.canBeBoosted(item.accountID)); }