Skip to content
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

feat(attachment remover): hide option if no permission nor outside edit time limit #179

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/test-cases/plugins/attachment-remover/MM-T5618.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ steps_hashed: 89aed0aabf59790c8ede1d5bed14e86026f66a255ccacad4299ba3aa43d58eb9dd

- System messages
- Posts without attachment
- Posts where the user lacks permission to edit
- Posts created after the edit time limit has expired

1. Create the above types of messages/posts and verify that the "Remove attachments" option is not present.

Expand Down
22 changes: 17 additions & 5 deletions data/test-cases/plugins/attachment-remover/MM-T5620.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,24 @@ steps_hashed: c53e077778f5b51096bb3bce8e97f7908d8213a491c7539e69fbca3730915b8904

**Step 1**

1. Post two messages with attachments: one where the user has permission to edit others' posts, and one without that permission.
2. Check if the "Remove attachments" option is available.
3. Attempt to remove attachments for both posts.
1. Post two messages with attachments: one where the user has permission to `Edit Own Posts` (configured in `System Console > Permission`), and one without that permission.
2. Check if the "Remove attachments" option is available for each post.
3. If available, remove the attachment from the post.

**Expected**

- The "Remove attachments" option is available for both posts.
- The "Remove attachments" option should only be available for posts where the user has permission to edit.
- If the user has permission, the attachment is removed, and the post is marked as `Edited`.
- If the user lacks permission, the attachment is not removed, and a system message displays `Can't remove attachments: Not authorized`.
- If the user lacks permission, the option to remove the attachment should not be available.

**Step 2**

1. Post two messages with attachments: one where the user has permission to `Edit Others' Posts` (configured in `System Console > Permission`), and one without that permission.
2. Verify if the "Remove attachments" option is available for each post.
3. If available, remove the attachment from the post.

**Expected**

- The "Remove attachments" option should only be available for posts where the user has permission to edit.
- If the user has permission, the attachment is removed, and the post is marked as `Edited`.
- If the user lacks permission, the option to remove the attachment should not be available.
8 changes: 4 additions & 4 deletions data/test-cases/plugins/attachment-remover/MM-T5621.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ steps_hashed: 58d32b3afdadaf57f4db05833e369598d077f6c7340a791a9794587f779d9e3dd7

**Step 1**

1. Set a post edit time limit (e.g., `60` seconds).
1. Enable `Edit Own Posts` in `System Console > Permission` and set the `Edit Post Time Limit` (e.g., `60` seconds).
2. Post a message with an attachment and remove it within the time limit.
3. Post another message with an attachment and attempt to remove it after the time limit.
3. Post another message with an attachment, then check if the "Remove attachments" option is still available after the time limit has passed.

**Expected**

- The "Remove attachments" option is available for both posts.
- The "Remove attachments" option should only be available within the edit time limit.
- Removing within the time limit successfully removes the attachment, and the post is marked as `Edited`.
- Attempting removal after the time limit fails, with a system message: `Can't remove attachments: Post is too old to edit`.
- Once the edit time limit has passed, the option to remove the attachment should no longer be available.
Loading