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

Redefine permission logic and Add tests for anonymous field and permissions #49

Merged

Conversation

sophiefeng18
Copy link

@sophiefeng18 sophiefeng18 commented Oct 2, 2024

Attempt to resolve: #18 #35 #15
Resolves: #41

Files Changed:
incorporated @J0nathanLai 's code for the anonymous field in src/posts/create.js
defined username display based on user role (admin or not) in src/posts/summary.js
added tests for anonymous field and permissions in test/posts.js
added safety check in src/controllers/search.js
cleaned up unnecessary code and console logs in src/api/posts.js, src/controllers/admin/privileges.js, src/middleware/user.js, and src/upgrades/1.4.4/sound_settings.js

Description:
Inside src/posts/summary.js, if the user is not admin, then the name showing up on anonymous posts would be "anonymous user." The test in test/posts.js checks if this logic plays out by setting up an admin user, a regular user, and an anonymous post posted by another regular user. The test checks if the admin user can see the username on the post while the regular user can only see "Anonymous User."

Justification for test not passing:
The test I wrote did not pass. The logic for the test should be correct, but the additional changes required to pass the test are beyond the scope of the implementation we made.

@sophiefeng18 sophiefeng18 self-assigned this Oct 6, 2024
@sophiefeng18 sophiefeng18 added the documentation Improvements or additions to documentation label Oct 6, 2024
@sophiefeng18 sophiefeng18 added this to the Sprint 2 milestone Oct 6, 2024
@sophiefeng18 sophiefeng18 linked an issue Oct 6, 2024 that may be closed by this pull request
@J0nathanLai J0nathanLai self-requested a review October 10, 2024 00:00
@sophiefeng18 sophiefeng18 changed the title Define permission logic in a different file Define permission logic with the anonymous field in post Oct 10, 2024
Copy link

@J0nathanLai J0nathanLai left a comment

Choose a reason for hiding this comment

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

The isAnon field doesn't exist anymore. src/api/posts.js and src/controllers/serach.js has that field.

@sophiefeng18 sophiefeng18 changed the title Define permission logic with the anonymous field in post Define permission logic and add tests for anonymous field and permissions Oct 10, 2024
@sophiefeng18 sophiefeng18 changed the title Define permission logic and add tests for anonymous field and permissions Redefine permission logic and Add tests for anonymous field and permissions Oct 10, 2024
@sophiefeng18 sophiefeng18 added enhancement New feature or request and removed documentation Improvements or additions to documentation labels Oct 10, 2024
Copy link

@J0nathanLai J0nathanLai left a comment

Choose a reason for hiding this comment

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

Looks good to me. However, some of our own tests are failing. Let's meet and discuss.

@J0nathanLai
Copy link

J0nathanLai commented Oct 10, 2024

Discussed why our own tests are failing. Not enough time to implement necessary changes that are outside the scope of our original implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants