Skip to content

Conversation

@Chuksll
Copy link

@Chuksll Chuksll commented Sep 30, 2025

  • Add endorsement database fields and core functionality
  • Implement API endpoints for endorsing/unendorsing posts
  • Add instructor privilege system and permission checks
  • Update post rendering to display endorsement status
  • Add frontend UI components and client-side handlers
  • Create database migration for instructors group
  • Add comprehensive language support and error messages

This feature allows instructors to endorse posts from students/TAs to provide authoritative confirmation and reduce confusion in community forums.

- Add endorsement database fields and core functionality
- Implement API endpoints for endorsing/unendorsing posts
- Add instructor privilege system and permission checks
- Update post rendering to display endorsement status
- Add frontend UI components and client-side handlers
- Create database migration for instructors group
- Add comprehensive language support and error messages

This feature allows instructors to endorse posts from students/TAs to provide
authoritative confirmation and reduce confusion in community forums.
@Chuksll Chuksll requested a review from Copilot October 2, 2025 13:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an instructor endorsement feature that allows instructors to endorse student/TA posts to provide authoritative confirmation and reduce confusion in forums. The feature implements comprehensive backend functionality with API endpoints, database fields, privilege system, and frontend UI components.

Key Changes:

  • Creates instructor user privilege system with dedicated "instructors" group
  • Implements full endorsement API with database fields for tracking endorsement state
  • Adds frontend UI components and real-time client-side handling

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/user/index.js Adds instructor privilege check function
src/upgrades/1727697600000.js Database migration to create instructors group
src/topics/posts.js Integrates endorsement data into post rendering
src/routes/write/posts.js Defines API routes for endorsement operations
src/privileges/users.js Implements instructor group membership check
src/privileges/topics.js Adds instructor privilege to topic context
src/privileges/posts.js Implements endorsement permission logic
src/posts/index.js Loads endorsement module
src/posts/endorsement.js Core endorsement functionality
src/posts/data.js Adds endorsement fields to post data structure
src/controllers/write/posts.js HTTP controllers for endorsement endpoints
src/api/posts_endorsement.js Dedicated API handlers for endorsement
src/api/posts.js Main API endpoint implementations
public/src/client/topic/postTools.js Client-side endorsement UI handlers
public/language/en-GB/topic.json UI text for endorsement feature
public/language/en-GB/error.json Error messages for endorsement operations
ENDORSEMENT_FEATURE.md Feature documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


module.exports = {
name: 'Create instructors group',
timestamp: Date.UTC(2025, 8, 30, 12, 0, 0),
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

The timestamp uses Date.UTC(2025, 8, 30, 12, 0, 0) which creates a date in September 2025 (month 8), but this appears to be inconsistent with the filename timestamp 1727697600000 which corresponds to September 30, 2024. The year should be 2024, not 2025.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +18
'use strict';

const posts = require('../posts');

const apiPosts = module.exports;

apiPosts.endorse = async (caller, data) => {
return await posts.endorse(data.pid, caller.uid);
};

apiPosts.unendorse = async (caller, data) => {
return await posts.unendorse(data.pid, caller.uid);
};

apiPosts.getEndorsement = async (caller, data) => {
const endorsementData = await posts.getEndorsementData([data.pid]);
return endorsementData[0] || { endorsed: false };
}; No newline at end of file
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

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

This file duplicates the exact same functionality as the methods added to src/api/posts.js (lines 656-667). Having identical API implementations in two separate files creates maintenance overhead and potential inconsistency. Consider removing this duplicate file and using only the implementations in src/api/posts.js.

Suggested change
'use strict';
const posts = require('../posts');
const apiPosts = module.exports;
apiPosts.endorse = async (caller, data) => {
return await posts.endorse(data.pid, caller.uid);
};
apiPosts.unendorse = async (caller, data) => {
return await posts.unendorse(data.pid, caller.uid);
};
apiPosts.getEndorsement = async (caller, data) => {
const endorsementData = await posts.getEndorsementData([data.pid]);
return endorsementData[0] || { endorsed: false };
};

Copilot uses AI. Check for mistakes.
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.

2 participants