Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Adjust how unique an admin action can be #233

Merged
merged 8 commits into from Oct 6, 2015
Merged

Adjust how unique an admin action can be #233

merged 8 commits into from Oct 6, 2015

Conversation

pypingou
Copy link
Member

@pypingou pypingou commented Oct 5, 2015

We cannot make unique an admin action based on its package, branch, user, action and status
otherwise we end up with a request closed, another open that cannot be closed with the same
status (unique constraints will fail).

What we can do otherwise is check if we have a request for that package on that branch and for this user and if so, we reset it.

This PR also adds a link to a request once it has been closed so that it can be sent to someone.

@@ -1712,13 +1712,25 @@ def add_new_branch_request(session, pkg_name, clt_to, user):
if clt_to.name == 'Fedora EPEL':
_validate_pkg(session, clt_to.version, package.name)

action = model.AdminAction(
action = model.AdminAction.search(
Copy link
Contributor

Choose a reason for hiding this comment

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

.search returns a collection of actions? This should be actions = model.AdminAction.search(... to make that clear.

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case it can only return 1 action as I am passing all the element that constitute the unique constraint, so it can only ever be a list of 1 item.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's still a list.

I saw action.pop() and thought "wtf. An AdminAction has a .pop() method?"

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

@ralphbean
Copy link
Contributor

Other than the cosmetic note above, 👍. Looks good!

pypingou added a commit that referenced this pull request Oct 6, 2015
Adjust how unique an admin action can be
@pypingou pypingou merged commit 8682161 into master Oct 6, 2015
@pypingou pypingou deleted the unique_aa branch October 6, 2015 16:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants