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

Only show Permanently Delete Button on Deleted Events page #309

Merged
merged 2 commits into from
May 29, 2024

Conversation

akirk
Copy link
Member

@akirk akirk commented May 28, 2024

Before

Currently an Admin will see a permanently delete button on all pages.

Screenshot 2024-05-28 at 13 40 51

After

I'd like to avoid accidentally deleting an event, so this button now only shows on the trashed events page:

Screenshot 2024-05-28 at 13 42 08

Screenshot 2024-05-28 at 13 42 16

@amieiro
Copy link
Collaborator

amieiro commented May 28, 2024

Currently, I can't see the "Delete permanently" in the trunk branch.

image

image

image

I can see the button only in the "Deleted Translation Events" page.

image

@akirk
Copy link
Member Author

akirk commented May 28, 2024

Well, you need a user that has the delete_translation_event permission, either through a filter or by being Super Admin.

Copy link
Collaborator

@trymebytes trymebytes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works well!

@amieiro
Copy link
Collaborator

amieiro commented May 28, 2024

I have tested it, and it works fine. In the event_repository, what do you think to check if the event has been trashed before deleted it?

	public function delete_event( Event $event ) {
		if ( ! $event->is_trashed() ) {
			return false;
		}
@psrpinto
Copy link
Member

In the event_repository, what do you think to check if the event has been trashed before deleted it?

That check is being done in the capabilities. I think it shouldn't be in the repository because there might be situations where you want to be able to delete without it being trashed.

@amieiro amieiro merged commit 02b9dc2 into trunk May 29, 2024
3 checks passed
@amieiro amieiro deleted the permanently-delete-only-on-trash-page branch May 29, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants