Page MenuHomePhabricator

Programs with Events and Events with Participants should not be deletable
Closed, ResolvedPublic2 Estimated Story Points

Description

You shouldn't be able to delete a program that has one or more events, or events with one or more participants.

Event Timeline

MusikAnimal added a subscriber: Niharika.

@Niharika Maybe you could clarify the expected behaviour? I'm just going off of memory. Are there also situations where you shouldn't be able to delete an Event?

@MusikAnimal Yeah, programs with >= 1 events should not be deletable. Similarly events with >= 1 participants should not be deleteable.

MusikAnimal renamed this task from Programs with Events are deletable to Programs with Events and Events with Participants should not be deletable.Feb 14 2018, 12:05 AM
MusikAnimal updated the task description. (Show Details)
Niharika set the point value for this task to 2.Feb 14 2018, 12:40 AM

If there are events/participants, the deletion buttons will now be grayed out. Attempting to click on it will show an alert with "This event cannot be deleted because it has one or more participants", etc. Admins can still delete any program/event.

This validation is currently only done in the frontend... because unfortunately in the model layer there's no concept of who's logged in. So it's possible for someone to hack their way into deleting their own program/event, but I don't think we need to worry about that right now. Maybe should create a ticket, though.

Commit: https://github.com/wikimedia/grantmetrics/commit/18a37f8dbee8da0b654c1be3604d0eaf3dde93a7

I couldn't get this to work on ToolForge. I'm trying to delete an event which has participants and it lets me delete it. I'm on Safari. No console errors.

I couldn't get this to work on ToolForge. I'm trying to delete an event which has participants and it lets me delete it. I'm on Safari. No console errors.

Are you using your admin account?

I couldn't get this to work on ToolForge. I'm trying to delete an event which has participants and it lets me delete it. I'm on Safari. No console errors.

Are you using your admin account?

Yes. Can admins delete irrespective of data?

Yes. Can admins delete irrespective of data?

Indeed! Use your admin powers wisely :)

It's easy to change it so that admins aren't exempt from this restriction, but I figure if you did need to delete something, it might be a pain to have to first go through and delete each individual participant/event. You already get a confirmation popup, so hopefully there won't be any accidents.

Niharika moved this task from Needs Review/Feedback to Q1 2018-19 on the Community-Tech-Sprint board.

Aha, makes sense. Shouldn't be a problem. This will definitely make it easy to deal with spam, if we have to. Thanks!