Skip to content
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

pass id instead of uuid for journalist_id #1147

Merged
merged 1 commit into from
Sep 30, 2020
Merged

pass id instead of uuid for journalist_id #1147

merged 1 commit into from
Sep 30, 2020

Conversation

sssoleileraaa
Copy link
Contributor

@sssoleileraaa sssoleileraaa commented Sep 24, 2020

Description

Fixes #1148

When creating a Reply object, journalist_id needs to match the id of the authenticated user, not the uuid supplied in the token. There is ongoing work around how we manage authentication so this PR provides a minimal solution.

Test Plan

Check behavior is the same

  1. Send succesful, pending, and failed replies (you can apply these diffs to simulate failed and pending replies: https://gist.github.com/creviera/7f19a7d10334359f40dbdbb2354cd13a, https://gist.github.com/creviera/5ba70d50c12b6a6df6f98ed40ad09645)
  2. Check that sending replies still works
  3. Log out and check that you cannot send a reply
  4. Invalidate token and check that you cannot send a reply

Check db

  1. Checkout main and send a successful reply, a failed reply, and pending reply (you can apply these diffs to simulate failed and pending replies: https://gist.github.com/creviera/7f19a7d10334359f40dbdbb2354cd13a, https://gist.github.com/creviera/5ba70d50c12b6a6df6f98ed40ad09645)
  • Open sqlite db and see that UUID is stored instead of ID for journalist_id.
  1. Checkout this PR branch and repeat step 1
  • Open sqlite db and see that ID is stored instead of UUID for journalist_id.

(Database migration for migrating replies.jouranlist_id wherever UUID was used instead of IDs will be needed for both the replies and draftreplies tables.)

Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

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

Worked according to the test plan below.

Test Plan

Check behavior is the same

  1. Send succesful, pending, and failed replies (you can apply these diffs to simulate failed and pending replies: https://gist.github.com/creviera/7f19a7d10334359f40dbdbb2354cd13a, https://gist.github.com/creviera/5ba70d50c12b6a6df6f98ed40ad09645)
  2. Check that sending replies still works
  3. Log out and check that you cannot send a reply
  4. Invalidate token and check that you cannot send a reply

Check db

  1. Checkout main and send a successful reply, a failed reply, and pending reply (you can apply these diffs to simulate failed and pending replies: https://gist.github.com/creviera/7f19a7d10334359f40dbdbb2354cd13a, https://gist.github.com/creviera/5ba70d50c12b6a6df6f98ed40ad09645)
  • Open sqlite db and see that UUID is stored instead of ID for journalist_id.
  1. Checkout this PR branch and repeat step 1
  • Open sqlite db and see that ID is stored instead of UUID for journalist_id.

@kushaldas kushaldas merged commit 02918ec into main Sep 30, 2020
@kushaldas kushaldas deleted the fix-id-bug branch September 30, 2020 08:33
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.

passing incorrect id when creating replies in db
2 participants