Fixes an issue where replying to a reblog doesn't fill in the correct mentions in the composer. Closes #40

This commit is contained in:
Vavassor 2017-03-31 15:47:41 -04:00
parent 53376da406
commit 0f5130f692

View file

@ -64,16 +64,18 @@ public class SFragment extends BaseFragment {
protected void reply(Status status) { protected void reply(Status status) {
String inReplyToId = status.getActionableId(); String inReplyToId = status.getActionableId();
Status.Mention[] mentions = status.mentions; Status actionableStatus = status.getActionableStatus();
String replyVisibility = actionableStatus.getVisibility().toString().toLowerCase();
Status.Mention[] mentions = actionableStatus.mentions;
List<String> mentionedUsernames = new ArrayList<>(); List<String> mentionedUsernames = new ArrayList<>();
for (Status.Mention mention : mentions) { for (Status.Mention mention : mentions) {
mentionedUsernames.add(mention.username); mentionedUsernames.add(mention.username);
} }
mentionedUsernames.add(status.account.username); mentionedUsernames.add(actionableStatus.account.username);
mentionedUsernames.remove(loggedInUsername); mentionedUsernames.remove(loggedInUsername);
Intent intent = new Intent(getContext(), ComposeActivity.class); Intent intent = new Intent(getContext(), ComposeActivity.class);
intent.putExtra("in_reply_to_id", inReplyToId); intent.putExtra("in_reply_to_id", inReplyToId);
intent.putExtra("reply_visibility", status.getVisibility().toString().toLowerCase()); intent.putExtra("reply_visibility", replyVisibility);
intent.putExtra("mentioned_usernames", mentionedUsernames.toArray(new String[0])); intent.putExtra("mentioned_usernames", mentionedUsernames.toArray(new String[0]));
startActivity(intent); startActivity(intent);
} }