phanpy icon indicating copy to clipboard operation
phanpy copied to clipboard

Allow pasting attachments on Akkoma / Pleroma instances

Open Steffo99 opened this issue 1 year ago • 7 comments

Fixes #656.

See commit titles for info on how the bug was fixed!

Steffo99 avatar Sep 04 '24 23:09 Steffo99

@Steffo99 I saw the code formatting is a little off. Your code editor might need some prettier plugin to follow the project's prettier settings 🙇

cheeaun avatar Sep 05 '24 04:09 cheeaun

I saw the code formatting is a little off. Your code editor might need some prettier plugin to follow the project's prettier settings 🙇

Oh, I didn't notice the .prettierrc file, and I had my editor configured to use .editorconfig instead; thanks for letting me know!

Steffo99 avatar Sep 05 '24 08:09 Steffo99

What, shouldn't this:

https://github.com/cheeaun/phanpy/blob/0f6f20629ef4104bfdac10951b14dc0ed42e708f/src/components/compose.jsx#L1308-L1340

Share behaviour with this function?:

https://github.com/cheeaun/phanpy/blob/0f6f20629ef4104bfdac10951b14dc0ed42e708f/src/components/compose.jsx#L600-L647

I think that's the reason why the attach button worked but copy-and-pasting not in #656: onChange does not check mime types!

Steffo99 avatar Sep 05 '24 09:09 Steffo99

@cheeaun How would you want me to handle this? Should I just leave it alone? In that case, the PR is ready...

Steffo99 avatar Sep 05 '24 13:09 Steffo99

Whoops. Committed via web and forgot to enter commit text. A sec!

Steffo99 avatar Sep 07 '24 19:09 Steffo99

What, shouldn't this:

https://github.com/cheeaun/phanpy/blob/0f6f20629ef4104bfdac10951b14dc0ed42e708f/src/components/compose.jsx#L1308-L1340

Share behaviour with this function?:

https://github.com/cheeaun/phanpy/blob/0f6f20629ef4104bfdac10951b14dc0ed42e708f/src/components/compose.jsx#L600-L647

I think that's the reason why the attach button worked but copy-and-pasting not in #656: onChange does not check mime types!

You mean the filtering logic with supportedMimeTypes? The other one has accept attribute which should already filter the files (I hope).

cheeaun avatar Sep 08 '24 02:09 cheeaun

The other one has accept attribute which should already filter the files (I hope).

Alas, it doesn't prevent the user from adding files not matching the MIME types listed there, it just filters them by default in the file picker:

Screenshot of me changing file types in the KDE file picker.

I guess that's a https://github.com/cheeaun/phanpy/labels/bug for a different pull request, though.

Steffo99 avatar Sep 08 '24 13:09 Steffo99

Possible to resolve the conflicts here? Thanks

cheeaun avatar Oct 10 '24 01:10 cheeaun

@cheeaun Done!

There seem to be non-prettified files in the main branch; not modifying those to prevent more conflicts.

Steffo99 avatar Oct 11 '24 00:10 Steffo99