1
0
mirror of https://github.com/tuskyapp/Tusky synced 2024-12-27 17:23:34 +01:00

inherit content warnings in replys

This commit is contained in:
ntngrtltr 2017-04-07 20:37:27 +02:00
parent 632cb0d6e3
commit 50d386e271
2 changed files with 14 additions and 0 deletions

View File

@ -369,6 +369,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
String startingVisibility;
boolean startingHideText;
String startingContentWarning = null;
ArrayList<SavedQueuedMedia> savedMediaQueued = null;
if (savedInstanceState != null) {
showMarkSensitive = savedInstanceState.getBoolean("showMarkSensitive");
@ -411,6 +412,13 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
}
mentionedUsernames = intent.getStringArrayExtra("mentioned_usernames");
if(inReplyToId != null) {
startingHideText = !intent.getStringExtra("content_warning").equals("");
if(startingHideText){
startingContentWarning = intent.getStringExtra("content_warning");
}
}
}
/* Only after the starting visibility is determined and the send button is initialised can
* the status visibility be set. */
@ -476,6 +484,10 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
});
showContentWarning(startingHideText);
if(startingContentWarning != null){
contentWarningEditor.setText(startingContentWarning);
}
statusAlreadyInFlight = false;
// These can only be added after everything affected by the media queue is initialized.

View File

@ -66,6 +66,7 @@ public class SFragment extends BaseFragment {
String inReplyToId = status.getActionableId();
Status actionableStatus = status.getActionableStatus();
String replyVisibility = actionableStatus.getVisibility().toString().toLowerCase();
String contentWarning = actionableStatus.spoilerText;
Status.Mention[] mentions = actionableStatus.mentions;
List<String> mentionedUsernames = new ArrayList<>();
for (Status.Mention mention : mentions) {
@ -76,6 +77,7 @@ public class SFragment extends BaseFragment {
Intent intent = new Intent(getContext(), ComposeActivity.class);
intent.putExtra("in_reply_to_id", inReplyToId);
intent.putExtra("reply_visibility", replyVisibility);
intent.putExtra("content_warning", contentWarning);
intent.putExtra("mentioned_usernames", mentionedUsernames.toArray(new String[0]));
startActivity(intent);
}