Closed jaspervriends closed 3 years ago
This really is great work @jaspervriends thank you for your time in creating this feature! Might take a couple of days to go over this, please bear with us :)
This looks very nice! I probably also won't be able to review immediately, but I will try to get to it!
How are the image preview managed? Is it the full image? If so, does it load all of the images immediately or only as you scroll down? If a forum allows very large uploads, or someone just has many images, will it not bring the website down by loading all of them?
Awesome, take your time :)
This looks very nice! I probably also won't be able to review immediately, but I will try to get to it!
How are the image preview managed? Is it the full image? If so, does it load all of the images immediately or only as you scroll down? If a forum allows very large uploads, or someone just has many images, will it not bring the website down by loading all of them?
The files are loaded in batches as usual (20 files each), so it will depend on the overal image size. Currently the images are just using the path of the image. As there are no thumbnails generated by this extention :(
So if someone has any suggestions, let me know. Maybe generate it on-the-fly on a specific endpoint? fof/uploads/{file-id}/preview
? If so, would we cache that on the server, or just in the browser?
I'd love to hear other peoples' opinion about the following. Jasper and I had a discussion about the upload button, previous commits had it replaced by the media manager. Right now there's (yet) another button. Screen space is scarce, especially in the editor.
My suggestion is to allow an admin setting to choose between (upload button, media manager button or both). And then render accordingly. The media manager adds another click to upload.
I'm a fan of that. Maybe it's time to also replace the "Upload" text with a tooltip to match the other buttons in the editor toolbar?
@luceos I think an admin setting would be fine. What would be the default setting then? Both buttons visible? And optionally hide one of the buttons?
Maybe it's time to also replace the "Upload" text with a tooltip to match the other buttons in the editor toolbar?
Yup, I already gave the upload button a tooltip :)
@luceos @davwheat As requested, I've made some changes and worked on the feedback provided.
I've added an option called Composer buttons
to the admin dashboard:
Which results into:
If there is anything else, let me know!
Not sure on others' opinions, but it might be worth considering display: grid
again. Flarum doesn't use it elsewhere, but some other styles core and this ext use are incompatible with IE11, so using it wouldn't be a major issue, but it'd just make styling far easier.
Up to you at the end of the day -- both work fine!
@imorland I've updated the PR again and added an uploads overview to the user profile page (I agree it is a good addition too). Also, I added a fof-upload.viewUserUploads
to view uploads from other users for moderation purpose. By default the permission is set to moderators
in the migration file.
Also, I already added the fof-upload.deleteUserUploads
to the same migration file for future usage. There is no delete functionality yet, also, I am wondering what would be a good approach for this as there are multiple ways to upload files to different adapters.
When a user sees their own profile, the button label is My uploads
, when viewing another profile (and having the rights) they'll see User uploads
.
When you click a file in the user profile page, it will open the file URL.
Superb @jaspervriends - I'll take a closer look after work tonight!
In regards to deletion, I agree it's a tricky subject. My feeling is that instead of actually deleting the file from disk/bucket/whatever, which in turn could likely impact posts that have it embedded, we should instead 'delete from media manager'.
Perhaps this could be done by adding a column to the fof-upload-files
table, null
by default, to act as a flag as to if the file should be included in the media library?
Any thoughts on the above @jaspervriends ?
Ideally I'd like to get this merged before we start working on the beta 16 updates for this extension
I'll merge this now, @davwheat and I will add the 'delete from media manager' feature as described https://github.com/FriendsOfFlarum/upload/pull/262#issuecomment-777415577
I've implemented a user media upload manager with the idea of stopping multi-uploads from the same file. The files were already attached to the user, so I did not change anything of that.
Changelog:
/fof/uploads
endpoint/fof/upload
endpoint outputFileSerializer
File
frontend modelModal features: The media manager is expandable minded. Other extensions could open the
FileManagerModal
modal component and attach custom params to customize their needs.The file manager is responsive, has drag & drop support and automatically selects the uploaded files. After clicking the 'Select files' button, the files will be added with their
bbcode
to the composer.onSelect
: Optional, custom callback, default:adds bbcode to composer
multiSelect
: Optional, allow multiple selections, defaulttrue
restrictFileType
: Optional, restrict file selection to specific types, defaultnull
, supported values:[array]
image
audio
video
This PR Let's focus on the code and improvements/removals:
fof-upload-dropping
andthis.isDropping
.Updated composer buttons
Automatically select uploaded files
Example: Restricted to file type
image
Night mode
Mobile view