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

Modified code in src/topics to allow users to mark a question as "Good." #15

Merged
merged 10 commits into from
Feb 28, 2025

Conversation

arjuanwall
Copy link
Contributor

@arjuanwall arjuanwall commented Feb 10, 2025

Files edited:

  • nodebb-theme-harmony/scss/topic.scss - Added the post/goodquestion topic.

  • nodebb-theme-harmony/templates/partials/topic/post.tpl - Added the good question button on the front-end.

  • public/language/en-US/admin/manage/privileges.json and public/language/en-US/topic.json - Added button name.

  • src/posts/votes.js - Added the ability to mark the question as Good as a function.

  • src/privileges/topics.js, src/upgrades/1.7.4/vote_privilege.js - Give users admin access to mark a question as Good.

  • test/goodQuestion.js - Added comprehensive testing for this feature (marking, unmarking).

  • Feature was tested by running npm run lint and test to ensure that this did not break any other functionality in NodeBB.

Resolves #2

@arjuanwall arjuanwall self-assigned this Feb 10, 2025
@bingbhakdibhumi
Copy link
Contributor

LGTM

@phiofuni
Copy link
Contributor

Code is well formatted! Maybe add some comments.

@eenkhbol
Copy link
Contributor

Looks good, I agree with Jackson though - having comments would help the rest of us contribute later

@coveralls
Copy link

coveralls commented Feb 26, 2025

Pull Request Test Coverage Report for Build 13578493723

Details

  • 3 of 15 (20.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 82.63%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/posts/votes.js 2 14 14.29%
Totals Coverage Status
Change from base Build 13233678202: -0.04%
Covered Lines: 22324
Relevant Lines: 25596

💛 - Coveralls

@@ -116,6 +116,28 @@ module.exports = function (Posts) {
}
}

Posts.goodquestion = async function (pid, uid) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to make a comment here to explain what the Posts.goodquestion do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

[component="post/upvote"],
[component="post/downvote"],
[component="post/goodquestion"] {

Copy link
Contributor

Choose a reason for hiding this comment

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

remove extra line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -6,7 +6,7 @@
"group-privileges": "Group Privileges",
"user-privileges": "User Privileges",
"edit-privileges": "Edit Privileges",
"select-clear-all": "Select/Clear All",
"select-clear-all": "Select/Clear All",
Copy link
Contributor

Choose a reason for hiding this comment

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

could probably mimic these changes in the en-UK version of the .json too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@phiofuni phiofuni added the enhancement New feature or request label Feb 27, 2025
Copy link
Contributor

@eenkhbol eenkhbol 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! You can go ahead and merge.

@arjuanwall arjuanwall merged commit 98f71e0 into main Feb 28, 2025
1 of 2 checks passed
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
Development

Successfully merging this pull request may close these issues.

Mark a question "Good"
5 participants