Skip to content

Commit

Permalink
fix(ComposeFragment): allow pixelfed replies with no attachements
Browse files Browse the repository at this point in the history
Pixelfed only allows posting posts with a text and atleast one
attachements, but repliesn can be text only.
Closing LucasGGamerM#519
  • Loading branch information
FineFindus committed Aug 28, 2024
1 parent 998a469 commit 401f2b3
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit 401f2b3

Please sign in to comment.