From 88df8216a6042a20709a94386653c106940fc00a Mon Sep 17 00:00:00 2001 From: Vavassor Date: Fri, 31 Mar 2017 20:53:05 -0400 Subject: [PATCH] Fixes direct messages falsely being shown as able to be boosted. --- .../java/com/keylesspalace/tusky/StatusViewHolder.java | 2 +- .../java/com/keylesspalace/tusky/entity/Status.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java index 5efa94fb2..88114c0b6 100644 --- a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java @@ -382,7 +382,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder { hideSensitiveMediaWarning(); } setupButtons(listener, realStatus.account.id); - setRebloggingEnabled(realStatus.visibility != Status.Visibility.PRIVATE); + setRebloggingEnabled(status.rebloggingAllowed()); if (realStatus.spoilerText.isEmpty()) { hideSpoilerText(); } else { diff --git a/app/src/main/java/com/keylesspalace/tusky/entity/Status.java b/app/src/main/java/com/keylesspalace/tusky/entity/Status.java index b130ef97d..cc7f990a1 100644 --- a/app/src/main/java/com/keylesspalace/tusky/entity/Status.java +++ b/app/src/main/java/com/keylesspalace/tusky/entity/Status.java @@ -47,12 +47,15 @@ public class Status { } public enum Visibility { + UNKNOWN, @SerializedName("public") PUBLIC, @SerializedName("unlisted") UNLISTED, @SerializedName("private") PRIVATE, + @SerializedName("direct") + DIRECT, } public String id; @@ -81,6 +84,13 @@ public class Status { return visibility == null ? Visibility.UNLISTED : visibility; } + public boolean rebloggingAllowed() { + return visibility != null + && visibility != Visibility.PRIVATE + && visibility != Visibility.DIRECT + && visibility != Visibility.UNKNOWN; + } + @SerializedName("media_attachments") public MediaAttachment[] attachments;