Skip to content

[$100] When an image is pasted in the editor window by a normal user, the error ribbon is shown in the editor #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sdgun opened this issue Nov 3, 2020 · 15 comments

Comments

@sdgun
Copy link
Collaborator

sdgun commented Nov 3, 2020

Steps
Go to the forums as a normal user (ex user- TopConnCustomer link - https://vanilla.topcoder-dev.com/)
Click New Discussion
Paste an image in the editor

Actual result
The error ribbon is shown in the editor

Expected result
The error ribbon should not be shown in the editor

File attach error.zip

@sdgun sdgun added bug Something isn't working Dev env P4 labels Nov 3, 2020
@jmgasper jmgasper changed the title When an image is pasted in the editor window by a normal user, the error ribbon is shown in the editor [$50] When an image is pasted in the editor window by a normal user, the error ribbon is shown in the editor Nov 3, 2020
@jmgasper
Copy link
Collaborator

jmgasper commented Nov 3, 2020

Contest https://www.topcoder.com/challenges/30148426 has been created for this ticket.

This is an automated message for ghostar via Topcoder X

@jmgasper
Copy link
Collaborator

jmgasper commented Nov 3, 2020

Contest https://www.topcoder.com/challenges/30148426 has been updated - it has been assigned to obog.

This is an automated message for ghostar via Topcoder X

@jmgasper
Copy link
Collaborator

jmgasper commented Nov 3, 2020

@atelomycterus - I'm open to suggestions on this one.

@atelomycterus
Copy link
Collaborator

@jmgasper 'Allow File Uploads' Vanilla permission is used for any files (attachments/images).
Each category has 'Allow File Uploads' and users are not allowed to upload any files by default.

We've implemented Roles setup for attachments (#60):

We'll also need to set up some defaults, for instance:
Regular members will not be able to attach files to posts
Copilots will be able to attach files to posts

So all files from an editor are uploaded via Vanilla REST API (/v2/media). If user is allowed to upload images then we need to fix \Vanilla\package\applications\dashboard\controllers\api\MediaApiController. At least check for image file types.

So let me know if regular members (Vanilla member role) are allowed to upload images for any category or a specific category.

@jmgasper
Copy link
Collaborator

jmgasper commented Nov 4, 2020

@atelomycterus - Regular members will not be allowed to upload images at all, for any category (at least at this current time).

@rootelement ☝️ Correct me if I'm wrong.

@rootelement
Copy link
Contributor

Correct

@jmgasper jmgasper changed the title [$50] When an image is pasted in the editor window by a normal user, the error ribbon is shown in the editor [$100] When an image is pasted in the editor window by a normal user, the error ribbon is shown in the editor Dec 1, 2020
@jmgasper
Copy link
Collaborator

jmgasper commented Dec 1, 2020

@atelomycterus - If you need anything else here, let me know, thanks!

@atelomycterus
Copy link
Collaborator

@jmgasper I wanted to reproduce this issue in DEV but I noticed that posting format is text. Rich Editor has a simple view in DEV. If post format is text then user can't upload images/attachments. Let me know if we are going to use Rich format. I'll update FormatInput in config.php.

image

image

@jmgasper
Copy link
Collaborator

jmgasper commented Dec 4, 2020

@atelomycterus - Not sure what happened there. I just turned the rich editor off and on again and it appears to be working now.

@atelomycterus
Copy link
Collaborator

atelomycterus commented Dec 4, 2020

@jmgasper We've already tweaked permissions for copliot and regular members. All works as expected.

@atelomycterus - Regular members will not be allowed to upload images at all, for any category (at least at this current time).

Regular members can't upload any files including images. I've signed in as a regular member, The file/image buttons are not displayed because I don't have permissions to upload files. I've tested it for discussions and comments.
If I drag and drop a file into the editor, then it tries to upload it to the server. The permissions are checked on the server before saving a file. I (regular member) don't have permission to upload files. 403 Error - no permissions.
If this error message confuses users, then we can return a more specific message for this case ('No permissions to upload files.')
Let me know if I should fix a message.

File/image button is not displayed if User doesn't have upload permissions:
image

Drag and drop a file without Upload permissions:
image

  1. Rich editor config: 'Markdown' was in the config ([$25] Investigate deploy issue #236)
    If RichEditor doesn't support format then Text is set by default. I saw a simple Rich Editor View in sdgun's video.
    At first I thought that maybe this new requirement from the Topсoder team. That is why I asked you about the format.
    I've updated a config file. 'Rich' is default format.

@jmgasper
Copy link
Collaborator

jmgasper commented Dec 4, 2020

@atelomycterus - Yeah, I think if we can just say something like You don't have permission to upload files, that would be good. Sorry about the format problem - that was my fault. Thanks for fixing that.

@atelomycterus
Copy link
Collaborator

@jmgasper PR-#266 - update a message in the Rest API. Unfortunately, need to fix and rebuild frontend because the editor displays the hard-coded error message. We have several frontend issues. I'm going to fix them tomorrow.
image

image

@atelomycterus
Copy link
Collaborator

@jmgasper Ready for review. Please apply PR-#269. Thanks!

Testing

Clear browser cache before testing.

image

@jmgasper
Copy link
Collaborator

jmgasper commented Dec 5, 2020

Payment task has been updated: https://software.topcoder.com/review/actions/ViewProjectDetails?pid=30148426

This is an automated message for ghostar via Topcoder X

@sdgun
Copy link
Collaborator Author

sdgun commented Dec 7, 2020

Verified. After clearing cache, the given message is shown when drag and drop files. Pasting is disabled. However it seems like the file is being attached first and then the error is displayed.

Screencast 2020-12-07.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants