-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
urls: Change the method for adding alert words from PUT to POST. #6611
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
Conversation
Hello @zulip/server-api, @zulip/server-misc members, this pull request was labeled with the "area: api", "area: uploads" labels, so you may want to check it out! |
4676985
to
b83fc18
Compare
zproject/urls.py
Outdated
'POST': 'zerver.views.alert_words.set_alert_words', | ||
'PUT': 'zerver.views.alert_words.add_alert_words', | ||
'POST': 'zerver.views.alert_words.add_alert_words', | ||
'PUT': 'zerver.views.alert_words.set_alert_words', |
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.
I thought our idea was to just remove the PUT
version and only have POST
be add_alert_words
. We don't need to support set_alert_words
as an interface anymore; we should just remove the code for it.
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.
Thanks for the feedback! That's what I initially thought :) But then I noticed that replacing the list of alert words with new values seems useful in tests (for example, here) and got confused. I'll remove the PUT endpoint and change the test then.
Thanks for working on this @alenavolk! It looks good; I posted one comment. |
We could move set_alert_words to be a function on zuliptestcase, perhaps?
…-Tim Abbott (mobile)
On Sep 22, 2017 7:21 PM, "Alena Volkova" ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In zproject/urls.py
<#6611 (comment)>:
> @@ -365,8 +365,8 @@
# users/me/alert_words -> zerver.views.alert_words
url(r'^users/me/alert_words$', rest_dispatch,
{'GET': 'zerver.views.alert_words.list_alert_words',
- 'POST': 'zerver.views.alert_words.set_alert_words',
- 'PUT': 'zerver.views.alert_words.add_alert_words',
+ 'POST': 'zerver.views.alert_words.add_alert_words',
+ 'PUT': 'zerver.views.alert_words.set_alert_words',
Thanks for the feedback! That's what I initially thought :) But then I
noticed that replacing the list of alert words with new values seems useful
in tests (for example, here
<https://github.com/alenavolk/zulip/blob/b83fc18ec04a13aa7e90f00e1af9746242965f17/zerver/tests/test_alert_words.py#L33>)
and got confused. I'll remove the PUT endpoint and change the test then.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#6611 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACnm2rzzGiTc5ktbM0bgnLtv3rIpqSZcks5slED1gaJpZM4Pego6>
.
|
@timabbott Thanks for the idea, I'll look into that. |
b83fc18
to
800c21f
Compare
800c21f
to
4d6cfd0
Compare
@timabbott Could you please review this when you have a chance? I split the changes between two commits for now. The first one simply removes the old POST endpoint. I realized that there's no reason to use it in tests after all. The test case I mentioned above doesn't really require replacing the list of alert words with new values, because the user starts out with an empty list anyway. The second one changes the method for adding alert words from PUT to POST and updates all related requests within the project. |
4d6cfd0
to
597c00b
Compare
This is great! Merged, thanks @alenavolk! |
If you're looking for a next thing to do using what you learned doing this: (1) Deleting the How do those projects sound? |
@timabbott The projects sound great! I'll get to them soon. |
This deals with the last 1/4 of the issue #5676.
I think the best way to go about this issue is to simply switch the POST and PUT endpoints places, so that the POST endpoint is responsible for adding new values to the list of alert words, and the PUT endpoint is responsible for replacing the list of alert words with new values.
I corrected all related POST and PUT requests within the project, and did my best to make sure that apps like
zulip-electron
,zulip-mobile
, etc. are not using this API, but it is always good to have someone else look over and check.Please let me know if I missed something or there is a better way to approach this issue.