Skip to content

use anonymous user ID when calling the edxnotes retirement endpoint#18305

Merged
pwnage101 merged 1 commit intomasterfrom
pwnage101/edxnotes-retirement-use-anon-id
Jun 1, 2018
Merged

use anonymous user ID when calling the edxnotes retirement endpoint#18305
pwnage101 merged 1 commit intomasterfrom
pwnage101/edxnotes-retirement-use-anon-id

Conversation

@pwnage101
Copy link
Contributor

@pwnage101 pwnage101 commented Jun 1, 2018

I was thrown off by the function signature of delete_all_notes_for_user taking a user_id but not explaining that it's in fact an anonymous user id (according to the model definition in the edx-notes-api repo). I simplified it to just take a django User object, and put the anonymous user magic within.

Testing this has been a bear, without loadtest being available. I'll look into deploying notes in my devstack, but honestly I think it'll be faster to let this hit stage and test there since we're currently the only consumers of this endpoint.

@pwnage101 pwnage101 requested a review from yro June 1, 2018 17:45
Copy link
Contributor

@bmedx bmedx left a comment

Choose a reason for hiding this comment

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

Ah dang. Sad that it doesn't 404 or something when it doesn't find a user like Forums does.

@edx-status-bot
Copy link

Your PR has finished running tests.

@macdiesel
Copy link
Contributor

Could we make it 404 on not found so it's a bit more uniform?

@pwnage101
Copy link
Contributor Author

pwnage101 commented Jun 1, 2018

Unfortunately, the notes service doesn't keep track of users, only notes. So, if the service were to return "Not Found", that would imply any one of the following:

  1. user wasn't found (maybe wrong user id, maybe the user was already retired).
  2. the user just hadn't written any notes yet.

#1 is solid grounds for a 404, but I'd argue #2 isn't.

@macdiesel
Copy link
Contributor

We should go through and look but I believe the forums service makes the same assumption. If a user hasn't create a forms post, they don't exist in that IDA and a 404 is returned.

@bmedx
Copy link
Contributor

bmedx commented Jun 1, 2018

Forums users are created on registration these days, but if that fails we eat the error and attempt to create them at some point when they try to use the forums. Post time maybe? Either way, I think I'm with Troy on this one, if there's no concept of a user it seems weird to error that there isn't one.

Copy link
Contributor

@macdiesel macdiesel left a comment

Choose a reason for hiding this comment

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

I acquiesce.

@pwnage101 pwnage101 merged commit 225b3e6 into master Jun 1, 2018
@pwnage101 pwnage101 deleted the pwnage101/edxnotes-retirement-use-anon-id branch June 1, 2018 18:36
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production on Monday, June 04, 2018.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants