From 89af75a05a224a5a95910a2e4be0c49749353721 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Tue, 27 Aug 2024 20:24:11 +0200 Subject: [PATCH] fix(ComposeFragment): allow pixelfed replies with no attachements Pixelfed only allows posting posts with a text and atleast one attachements, but repliesn can be text only. Closing https://github.com/LucasGGamerM/moshidon/issues/519 --- .../joinmastodon/android/fragments/ComposeFragment.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index 0c87e48e99..3c34522d76 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -1051,13 +1051,17 @@ private void resetPublishButtonText() { public void updatePublishButtonState(){ uuid=null; + boolean isReply=replyTo!=null; + // pixelfed only allows posts with images, but replies can be text-only + boolean isValidPixelfedPost=!isInstancePixelfed() || (isReply || !mediaViewController.isEmpty()); + boolean isValidPost= isValidPixelfedPost && (trimmedCharCount>0 || !mediaViewController.isEmpty()) && charCount<=charLimit && mediaViewController.getNonDoneAttachmentCount()==0 && (pollViewController.isEmpty() || pollViewController.getNonEmptyOptionsCount()>1); if(GlobalUserPreferences.relocatePublishButton && publishButtonRelocated != null){ - publishButtonRelocated.setEnabled((!isInstancePixelfed() || !mediaViewController.isEmpty()) && (trimmedCharCount>0 || !mediaViewController.isEmpty()) && charCount<=charLimit && mediaViewController.getNonDoneAttachmentCount()==0 && (pollViewController.isEmpty() || pollViewController.getNonEmptyOptionsCount()>1)); + publishButtonRelocated.setEnabled(isValidPost); } if(publishButton==null) return; - publishButton.setEnabled((!isInstancePixelfed() || !mediaViewController.isEmpty()) && (trimmedCharCount>0 || !mediaViewController.isEmpty()) && charCount<=charLimit && mediaViewController.getNonDoneAttachmentCount()==0 && (pollViewController.isEmpty() || pollViewController.getNonEmptyOptionsCount()>1)); + publishButton.setEnabled(isValidPost); } private void onCustomEmojiClick(Emoji emoji){