Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Edit claimed packages #4404

Merged
merged 9 commits into from Apr 28, 2017
Merged

Conversation

chadwhitacre
Copy link
Contributor

@chadwhitacre chadwhitacre commented Apr 10, 2017

Part of #4305, follows on #4398.

Todo

  • set homepage to URL on npmjs.com
  • set initial product_or_service to npm description
  • set initial image as wombat(?)
  • retain npm indicator over profile image for claimed packages
  • create review ticket, I guess? one ticket for all packages claiming?
  • regular project pages should work:
    • project profile
    • distributing didn't check; let's make an 🐴 out of you and me
    • receiving
    • listing on homepage
    • listing in search results
    • listing on participant profile
    • edit—just can't change homepage
    • review/reject
    • close—package goes back to being unclaimed

@chadwhitacre chadwhitacre changed the base branch from master to project/claim-packages-view April 10, 2017 17:09
@chadwhitacre chadwhitacre changed the title Project/claim packages edit Edit claimed packages Apr 10, 2017
@chadwhitacre
Copy link
Contributor Author

aba9ae7

screen shot 2017-04-10 at 3 49 30 pm

@chadwhitacre
Copy link
Contributor Author

chadwhitacre commented Apr 11, 2017

I'm pretty close on review url adaptations. Will pick up tomorrow in a bit ...

@chadwhitacre
Copy link
Contributor Author

Hey, look what's on my profile page! :-)

screen shot 2017-04-11 at 2 15 25 pm

@chadwhitacre
Copy link
Contributor Author

After closing:

screen shot 2017-04-11 at 2 17 00 pm

@chadwhitacre
Copy link
Contributor Author

Broken image when 410 also affects non-package projects.

screen shot 2017-04-11 at 2 20 22 pm

@chadwhitacre
Copy link
Contributor Author

Review, Receiving: ✓

screen shot 2017-04-11 at 2 40 55 pm
screen shot 2017-04-11 at 2 41 04 pm
screen shot 2017-04-11 at 2 40 38 pm

@chadwhitacre
Copy link
Contributor Author

chadwhitacre commented Apr 11, 2017

💃


screen shot 2017-04-11 at 2 46 14 pm


screen shot 2017-04-11 at 2 46 25 pm

@chadwhitacre
Copy link
Contributor Author

Okay! Leaving off with this one, on to the next!

"""Given team objects, POST to GitHub, and return the URL of the new issue.
"""
if not teams:
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe log and/or raise an Exception, unless this is expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in bcb5b11.

package = self.make_package(name='enterprise')
with self.db.get_cursor() as c:
team = package.create_linked_team(c, alice)
pytest.raises(AssertionError, team.update, field='foo')
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this testing homepage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops! Fixed in ff933e9. 😊

@chadwhitacre chadwhitacre force-pushed the project/claim-packages-view branch 3 times, most recently from ca01581 to da0c3da Compare April 24, 2017 21:21
@chadwhitacre
Copy link
Contributor Author

Half-way through rebasing, will pick up next time ...

package_ids.append(package.id)
team = package.get_or_create_linked_team(cursor, self)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dowski Related to #4397 (comment), it looks like this is where it becomes useful public API to return a team object from get_or_create_linked_team. You okay to bring that back here, to avoid an awkward package._load_team(cursor)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 80d2655.

@chadwhitacre
Copy link
Contributor Author

Rebased, was a10ca2e.

@chadwhitacre
Copy link
Contributor Author

@dowski Note be18500 as well, new commit. Ready for review!

@chadwhitacre
Copy link
Contributor Author

chadwhitacre commented Apr 26, 2017

Actually, moved that to #4422 to keep this PR manageable (we target 400 max net lines changed per PR).

@dowski dowski changed the base branch from project/claim-packages-view to project/claim-packages April 27, 2017 02:22
Copy link
Contributor

@dowski dowski left a comment

Choose a reason for hiding this comment

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

One minor thing - nice clean code!

review_url = self.app.project_review_repo.create_issue(*teams)

cursor.run('DELETE FROM claims WHERE nonce=%s', (nonce,))
cursor.run('UPDATE teams SET review_url=%s WHERE id=ANY(%s)', (review_url, team_ids,))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this stuff happening in a transaction? Maybe there's a test that verifies that or something - I'll look as I scroll down.

I didn't see one. Maybe you know? I can't really tell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you're seeing cursor instead of self.db then yes, the expectation is that this is happening in a transaction. The transaction begins when the cursor is created, which happens in a context manager invocation. It will be rolled back if there's an exception, or committed when the context manager exits normally. Docs.

In terms of a test, I believe we're covered by the one added in eaa8699 under #4397, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@dowski dowski merged commit e5a2538 into project/claim-packages Apr 28, 2017
@chadwhitacre chadwhitacre deleted the project/claim-packages-edit branch April 28, 2017 08:26
chadwhitacre added a commit that referenced this pull request Apr 28, 2017
chadwhitacre added a commit that referenced this pull request Apr 28, 2017
chadwhitacre added a commit that referenced this pull request May 5, 2017
chadwhitacre added a commit that referenced this pull request May 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants