refactor: move bosst check to status
This commit is contained in:
parent
22209efc37
commit
4383b11947
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue