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

Completed Implementation of Pin Topic Backend #47

Merged
merged 9 commits into from
Oct 11, 2024
Merged

Conversation

DhanyaShah
Copy link

Resolves:
#12, #13

This PR fulfils functionality left over from sprint one and successfully connects the pin button to backend logic allowing certain user groups to pin topics. This completes all the requirements for both front-end and back-end for this User Story- with acceptance criteria fulfilled. The pin functionality is extremely useful in allowing users to highlight certain posts making sure they are always 'pinned' to the top of the discussion.

The frontend for this button has been written and committed by @sschauk, while I worked on the backend after what was left off from Sprint 1.

Implementation and Changes:

After Sprint 1, the code was left unconnected to the frontend button and unable to pass the linter and test suite. At first, I attempted to connect our previous logic to the frontend button, however due to already existing pinning logic embedded into NodeBB, there were a lot of errors I faced in trying to reimplement this functionality. Therefore, I decided to use the existing pinning infrastructure and connections to help me connect my backend to the frontend button. The changes reflected in this PR are as follows:

Deletion of src/topics/pin.js that contained my previous implementation of the backend.
Edited src/topics/tools.js to shift functions from pin.js here, and refactor them.
Edited src/topics/index.js to remove sorting functions (as they were already implemented elsewhere)
Edited test/topics.js to add tests (elaborate on this below)
[Small changes to other files to correct linting errors]

In particular, the changes I made to tool.js included added functions from pin.js and correcting linting and logic errors so they pass the basic test suite. Additionally I edited this functions to add some more functionality like logging information about the post being pinned. I was then able to use the existing functions in public/src/client/topic/threadTools.js to connect my backend logic with the pin button.

Testing:

A number of different tests were added onto the test suite to make sure acceptance criteria was met. I was able to write meaningful backend tests that include testing whether the pin posts remain on top, whether posts remain pinned after logging out, whether ordering of the posts is maintained and whether only certain permissible users can pin posts among other things. These tests are elaborated on further in the UserGuide.

There is also a video attached below of my manual testing of the button:

demo.mp4

Copy link

@Alanna-Cao Alanna-Cao 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.

@DhanyaShah DhanyaShah merged commit 3a55413 into sprint2-main Oct 11, 2024
1 check passed
@DhanyaShah DhanyaShah deleted the pin-backend branch October 11, 2024 03:29
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.

3 participants