From 33b589f4a358abaef39c739bef8b1deaadfc07a9 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 31 May 2022 18:56:33 +0200 Subject: [PATCH] Fix issue #112 - Cross-account replies broken --- .../android/activities/ComposeActivity.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java b/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java index 4f93efcd..24a49501 100644 --- a/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java @@ -129,8 +129,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana statusReplyId = b.getString(Helper.ARG_STATUS_REPLY_ID); statusMention = (Status) b.getSerializable(Helper.ARG_STATUS_MENTION); account = (Account) b.getSerializable(Helper.ARG_ACCOUNT); - instance = b.getString(Helper.ARG_INSTANCE, BaseMainActivity.currentInstance); - token = b.getString(Helper.ARG_TOKEN, BaseMainActivity.currentToken); + instance = b.getString(Helper.ARG_INSTANCE, null); + token = b.getString(Helper.ARG_TOKEN, null); visibility = b.getString(Helper.ARG_VISIBILITY, null); accountMention = (app.fedilab.android.client.entities.api.Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION); } @@ -159,15 +159,16 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana status.visibility = scheduledStatus.params.visibility; statusDraft.statusDraftList = statuses; } + if (account == null) { + account = BaseMainActivity.accountWeakReference.get(); + } if (instance == null) { - instance = BaseMainActivity.currentInstance; + instance = account.instance; } if (token == null) { - token = BaseMainActivity.currentToken; - } - if (account == null) { - account = BaseMainActivity.accountWeakReference.get(); + token = account.token; } + StatusesVM statusesVM = new ViewModelProvider(ComposeActivity.this).get(StatusesVM.class); //Empty compose List statusDraftList = new ArrayList<>(); @@ -546,6 +547,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana statusDraft.statusDraftList = statusDrafts; statusDraft.instance = account.instance; statusDraft.user_id = account.user_id; + if (!canBeSent(statusDraft)) { return; }