forked from CMU-17313Q/cmu-17313q-f24-nodebb-f24-NodeBB
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adding an anonymous feature to allow users to post anonymously #30
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nodebb-f24-codehers into search-improving-sprint1
Pull Request Test Coverage Report for Build 11331092765Details
💛 - Coveralls |
Hakaabi
added
high effort
high effort task
mix of front-end & back-end
UserStory3
and removed
front-end
back-end
labels
Oct 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
high effort
high effort task
mix of front-end & back-end
UserStory3
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.
(sprint 1)
Initially the original milestone was to implement user story 2 feature 3 (enhancing search tool). However due to dependency issues (feature 2 of user tory 2 is not yet completed) we decided it would be better to start with user story 3 feature 2. This is reflected in the commit messages under this pull request. Goals are not yet met for this specific feature due to time constraint, but are planned to be met by the beginning of next week. So far, Refracted code in 2 files. src/post/create.js and src/topics/posts.js. this aims to resolve issue #19
(sprint 2)
Files edited and why:
-Front-end and back-end communication:
1.node_modules/../compser.js
Introduced logic to handle anonymous posts by adding an isAnonymous parameter to the pushData object in composer.newTopic. This ensures that when a user selects the anonymous option, it gets properly included in the topic creation request.
In the post() function, I added code to capture the state of the anonymous checkbox (#anonymousPostCheckbox). This checks if the user selected to post anonymously and passes the value to the back-end when the topic is submitted.
2.src/topics/index.js
Updated the logic in the topic loop to check if a topic is marked as anonymous (topic.isAnonymous). If topic.isAnonymous is set to 'true', the topic's user object is replaced with an anonymous display (i.e., username: 'Anonymous', displayname: 'Anonymous').
The modifications made to these file aimed to gap the communication between front-end and back-end implementations of the Anonymous feature. Aims to resolve issue #48.
-Main implementation of feature:
4.src/topic/posts.js
Modified the logic to handle the anonymous option when creating a new post by adding an isAnonymous property to the post creation loop 'postData.forEach((postObj, i)' and added an if statement, that ensures when 'isAnonymous' is true, the post's user information is overridden with a Anonymous user. this was done by changing the username and displayname to 'anonymous'.
Having worked on this feature from start to end, I think this file contains the main back-end logic of this feature. this aims to resolve issue #19.
-Database and schema modification:
5.src/posts/create.js
modified the data structure in the create function to include the isAnonymous field and standardized the 'isAnonymous' field as a Boolean for consistent handling of anonymous posts. I also added 'isAnonymous' in postData.
6.src/topics/create.js
Added 'isAnonymous' field to the topic creation process(database). this allows for the creation of anonymous topics by allowing users to specify whether their identity should be hidden during topic creation. (this was added after debugging topics/index.js)
7.public/../schemas/topicobject.yaml
Modified the topic schema to reflect the changes in the database, ensuring that the isAnonymous field is now part of the schema definition.
8.public/../schemas/postobject.yaml
Updated the post schema to include the isAnonymous field, aligning it with the database structure (src/posts/create.js).
The modifications made to these files aimed to resolve issue #49
-Screenshots of the console logs written to verify the implementation and manual testing of the Anonymous feature:
When an Anonymous post is made
When a Non-anonymous post is made