-
Notifications
You must be signed in to change notification settings - Fork 308
Edit teams. #3923
Edit teams. #3923
Conversation
650c229
to
04a3300
Compare
Alright! It's now possible to edit teams. 💃 |
Yay! 🍻 Screenshots please? |
Does this allow admins to edit teams? (Not sitting in front of machine I can test on.) |
WHERE id = %s | ||
RETURNING teams.*::teams | ||
|
||
""".format(cols, placeholders), vals+(self.id,)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also write to the events
table with details about the changes - we need admins to be able to view an 'audit log'. I'm digging up the ticket where this was discussed..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yess, that one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do.
@mattbk not yet. I was under the impression admins already had a friendly way of doing so. I can add it if it's needed. Would be minor changes. |
'onboarding_url', 'todo_url']) | ||
|
||
cols, vals = zip(*kw.items()) | ||
assert set(cols).issubset(updateable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this return a 500
if someone tries to force another column in there? Let's throw a 400
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't receive extra columns, at least not from the web endpoint. https://github.com/gratipay/gratipay.com/pull/3923/files#diff-8cd27f320d80ef3f1fed6dc52f5feafdR40 makes sure of that. This check is just in case this is called from somewhere else in future in which case they should catch the exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍, makes sense
No, it's been happening through the database, so those of us without db access haven't been able to edit Teams. This PR solves us needing to do that for trivial things, however I think it's probably best to let admins edit anything a normal user can edit (someone can back me up or disagree on that). Thanks for doing this, it should speed up the review process considerably and give people more ownership of their Team accounts. |
Done @mattbk :)
Just doing my share in making gratipay better. :) |
todos - (mostly after review)
|
!m @aandis @mattbk @rohitpaulk I love watching this happen! It's so encouraging to not be a bottleneck! :-) |
One note I'll throw out there: let's be sure to log the old value in |
Editing team text fields seems to work for me (as admin). Might be nice to have either a breadcrumb/menu for going back, or a cancel button if the form is automatically opened. When I try to upload an image, I get this response: |
Interesting. I can't reproduce the error with any image types @mattbk. Can you paste the image you were trying to upload here? |
It was the first image that came up for "cat" on Google: https://www.petfinder.com/wp-content/uploads/2012/11/140272627-grooming-needs-senior-cat-632x475.jpg It could be a local issue with my virtual Ubuntu setup. If nobody else is having problems, we can probably carry on. |
Can somebody else please confirm? |
@rohitpaulk @whit537 Could one of you check the image upload? I think I'm not building things correctly on either machine :-\ Just for the record, now I get the same error whether or not I try to change the image. |
@mattbk can you apply for a new team locally from the home page and check whether you get the error? The image handling section is pretty much the same in both cases. |
Testing.. |
I'm curious to know how it is passing for you, @aandis 😄 |
I fixed #3923 (comment) in 3c191e1 |
I have that too, thought it was a local bug. Guess I was wrong. +1 |
Alright. Tests added and rebased on master. 💃 This is ✅ from my side. :) |
oooooooooh. There's a |
Works! The workflow to remove an image is a little weird to me (choose file->cancel), but that can probably be a different PR since most people will be replacing the image, not removing it.
|
Ha! I just recently started writing tests after @rohitpaulk's continuous advice and started thinking of them as a source of truth. Lesson learnt => Never trust tests 100%. Especially your own tests. 😉
You can't really remove a team image since you always need to have one so you'll always be replacing it. If you mean |
@aandis - There are tests that you can trust 100% :) Full-blown integration tests, which actually open a browser and click through, for example. |
You're right; I didn't click Modify to see that the image doesn't disappear. |
Cool! I'll look into the js tests and selenium someday as well. :) |
Merging. |
Yay! :)
One thing I want to point out here before this is deployed is that I decided to only log the old changed values since the most recent values are already present in the |
👍 from me. Thanks for this @aandis, awesome to see forward progress! 💃 |
💃💃 |
References #3545
wip.