Skip to content

feat: update new learner display and logic for improved visibility#5

Merged
naincy128 merged 6 commits intomasterfrom
naincy128/Cosmos2-735
Nov 5, 2025
Merged

feat: update new learner display and logic for improved visibility#5
naincy128 merged 6 commits intomasterfrom
naincy128/Cosmos2-735

Conversation

@naincy128
Copy link

@naincy128 naincy128 commented Oct 27, 2025

Description

This update introduces a new feature that displays a "New Learner" message beneath usernames in discussion posts and comments for users identified as new learners. The feature helps learners and staff quickly recognize new participants, improving clarity and community interaction.

The implementation integrates backend API fields for learner status, with fallback logic to support legacy and edge cases. Core discussion components were updated to pass learner status data through the component tree, along with new hooks and test coverage to ensure consistent and reliable functionality.

Features

  • Added a visible “👋 Hi, I am a new learner” message below usernames in discussion posts and comments for new learners, using backend API fields and fallback heuristics.
  • Added a regular learner message for users who no longer qualify as new learners.
  • Created new hooks:
    • useLearnerStatus – encapsulates learner status logic and consumes API data.
    • useIsNewLearner – determines whether a user qualifies as a new learner.
  • Updated core components including AuthorLabel, CommentHeader, Reply, and Post to receive and propagate a new postData prop containing learner status.
  • Updated prop types and default props across affected components to support the new prop.
  • Added internationalization (i18n) support for the new learner and learner messages in messages.js.
  • Added comprehensive test coverage to verify correct rendering behavior for different user roles (staff, moderators, anonymous, retired, regular, and new learners).

Linked PRs

Screenshot

image image

Jira Ticket

COSMO2-735

@naincy128 naincy128 marked this pull request as ready for review October 27, 2025 11:14
Copilot AI review requested due to automatic review settings October 27, 2025 11:14
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 a new learner identification feature that displays visual indicators ("👋 Hi, I am a new learner" or "Learner") beneath usernames in discussion posts and comments. The implementation relies on backend API fields (is_new_learner and is_regular_learner) with fallback logic for legacy support.

Key Changes:

  • Created two new hooks (useLearnerStatus and useIsNewLearner) to encapsulate learner status determination logic
  • Updated discussion components to pass postData prop through the component tree for learner status access
  • Added internationalized messages for new and regular learner indicators

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/discussions/posts/post/PostLink.jsx Extracts threadData and passes it to AuthorLabel via postData prop
src/discussions/posts/post/PostHeader.jsx Adds postData prop to component signature and forwards it to AuthorLabel
src/discussions/posts/post/Post.jsx Extracts threadData and passes it to child components
src/discussions/posts/post-editor/PostEditor.test.jsx Adds missing key prop to Route mapping
src/discussions/post-comments/comments/comment/Reply.jsx Extracts commentData and passes it to header and author components
src/discussions/post-comments/comments/comment/CommentHeader.jsx Adds postData prop and forwards it to AuthorLabel
src/discussions/post-comments/comments/comment/Comment.jsx Passes comment data to CommentHeader
src/discussions/messages.js Defines internationalized messages for learner indicators
src/discussions/data/hooks/useLearnerStatus.js New hook that determines learner status from API data with fallback logic
src/discussions/data/hooks/useIsNewLearner.js Convenience wrapper around useLearnerStatus
src/discussions/common/AuthorLabel.test.jsx Adds test coverage for learner message display logic
src/discussions/common/AuthorLabel.jsx Implements learner message display below username
src/discussions/common/AlertBar.jsx Adds postData prop and forwards it to AuthorLabel
src/discussions/common/AlertBanner.jsx Adds postData prop and forwards it to AlertBar

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@naincy128 naincy128 force-pushed the naincy128/Cosmos2-735 branch from 5c42e5f to ac2f7b9 Compare October 30, 2025 11:06
Copilot AI review requested due to automatic review settings October 30, 2025 11:06

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings October 30, 2025 11:24

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings October 30, 2025 11:37

This comment was marked as resolved.

@naincy128 naincy128 force-pushed the naincy128/Cosmos2-735 branch from adad012 to 5219e3f Compare October 30, 2025 11:47
Copilot AI review requested due to automatic review settings October 30, 2025 11:56

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings October 30, 2025 12:14

This comment was marked as resolved.

@naincy128 naincy128 force-pushed the naincy128/Cosmos2-735 branch 2 times, most recently from 396902e to aea6f1a Compare October 30, 2025 13:05
@naincy128 naincy128 force-pushed the naincy128/Cosmos2-735 branch from aea6f1a to 0e1d4fa Compare October 30, 2025 13:38
@naincy128 naincy128 force-pushed the naincy128/Cosmos2-735 branch from 63bffbe to 2dab849 Compare October 30, 2025 16:31
@naincy128 naincy128 force-pushed the naincy128/Cosmos2-735 branch from adbac96 to 9f8a570 Compare October 30, 2025 16:36
Copy link

@santhosh-apphelix-2u santhosh-apphelix-2u 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

@naincy128 naincy128 force-pushed the naincy128/Cosmos2-735 branch from cc7eeed to 23bb5bc Compare November 4, 2025 11:22
Copilot AI review requested due to automatic review settings November 4, 2025 11:22

This comment was marked as resolved.

@naincy128 naincy128 force-pushed the naincy128/Cosmos2-735 branch from 66abed4 to 73626e8 Compare November 4, 2025 11:26
@naincy128 naincy128 merged commit 675f4fc into master Nov 5, 2025
3 checks passed
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