When replying, set default post visibility to the most restrictive of: original post visibility, default visibility preference. (#641)

Issue #636
This commit is contained in:
Levi Bard 2018-05-09 23:04:00 +02:00 committed by Konrad Pozniak
parent 33c59cf578
commit 30fffcd9ca
1 changed files with 5 additions and 8 deletions

View File

@ -372,17 +372,14 @@ public final class ComposeActivity
if (intent != null) { if (intent != null) {
if (startingVisibility == Status.Visibility.UNKNOWN) { if (startingVisibility == Status.Visibility.UNKNOWN) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
Status.Visibility preferredVisibility = Status.Visibility.byString(
preferences.getString("defaultPostPrivacy",
Status.Visibility.PUBLIC.serverString()));
Status.Visibility replyVisibility = Status.Visibility.byNum( Status.Visibility replyVisibility = Status.Visibility.byNum(
intent.getIntExtra(REPLY_VISIBILITY_EXTRA, Status.Visibility.UNKNOWN.getNum())); intent.getIntExtra(REPLY_VISIBILITY_EXTRA, Status.Visibility.UNKNOWN.getNum()));
if (replyVisibility != Status.Visibility.UNKNOWN) { startingVisibility = Status.Visibility.byNum(Math.max(preferredVisibility.getNum(), replyVisibility.getNum()));
startingVisibility = replyVisibility;
} else {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
startingVisibility = Status.Visibility.byString(
preferences.getString("defaultPostPrivacy",
Status.Visibility.PUBLIC.serverString()));
}
} }
inReplyToId = intent.getStringExtra(IN_REPLY_TO_ID_EXTRA); inReplyToId = intent.getStringExtra(IN_REPLY_TO_ID_EXTRA);