Specified viewer groups for posts added (Do Not Accept!) #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses issue #20, authored by Alanna. This issue required posts to only be visible to users in specified groups based on the visibility preferences set by the student. The user should be able to specify viewers with the button attached.
File changes made:
nodebb-f24-team-sweepers/src/posts/create.js: Added field to post by student which represents visibility user group.
nodebb-f24-team-sweepers/src/posts/topics.js: Modified getPostsFromSet file to only make posts with correct visibility level for current user to be rendered.
nodebb-f24-team-sweepers/test/topics-viewers.js: Automated test suite for modifications and additions to above two files.
Please do not accept this PR as more work is required. Currently, the first set of tests within topics-viewers.js are passing meaning the db is correctly being manipulated with the correct post visibility field. However, the tests for rendering the correct posts based off user permissions are not yet passing.
Throughout the sprint, I faced challenges ensuring visibility preferences were correctly stored and reflected in the test suite. I learned to store post visibility levels by adding/editing database fields. The major obstacle leading to the delay in development was integrating the visibility logic with post rendering as posts were not filtering correctly for each group. Debugging led me to dive deeper into the database schema and user permission filtering logic. I urge anyone attempting to debug this to look at database get/set operations, user permission groups, and filtering logic.