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

Communication: Improve visibility of pinned messages #10117

Merged

Conversation

badkeyy
Copy link
Contributor

@badkeyy badkeyy commented Jan 8, 2025

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a test server configured with Gitlab and Jenkins.

Motivation and Context

The "Pin" function in Communication and Exercises is currently very bare-bones. Currently, selecting the pin option only changes the color of the message to orange, but it does not fulfill other expected functionalities associated with pinning messages. This PR improves this behaviour.

Fixes #10024

Description

  • Pinned messages now always show on top of the chat history in both Exercise communications and Communication threads
  • The header of a pinned message now has a Pin attached to it

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Programming Exercise with Communication enabled
  1. Log in to Artemis
  2. Navigate to the Exercise
  3. Write two messages in the communication tab
  4. Pin the second message
  5. Find the second message to now be on the top of the message history with a pin attached to its header
  6. Navigate to Communication
  7. Also find the message to be on top of the message history with a pin attached to his header
  8. Works equally for other channels in the communication tab
  9. (See attached GIF for graphical explanation)

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Screenshots

video

Summary by CodeRabbit

  • New Features

    • Added visual indication for pinned posts using a pushpin emoji
    • Enhanced post sorting to prioritize pinned posts in conversation and discussion sections
  • Improvements

    • Refined post display logic to separate pinned and unpinned posts
    • Improved user interface for identifying important posts

@badkeyy badkeyy requested a review from a team as a code owner January 8, 2025 16:11
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Jan 8, 2025
Copy link

coderabbitai bot commented Jan 8, 2025

Walkthrough

The pull request implements a pin functionality for messages across different components in the communication system. The changes involve modifying how posts are grouped, sorted, and displayed based on a new DisplayPriority attribute. The implementation ensures that pinned posts are given priority in the display order and are visually distinguished with a pushpin emoji. The modifications span multiple components, including conversation messages, discussion sections, and post headers.

Changes

File Change Summary
src/main/webapp/app/overview/course-conversations/...conversation-messages.component.ts Added DisplayPriority import and modified groupPosts method to separate pinned and unpinned posts
src/main/webapp/app/overview/discussion-section/discussion-section.component.ts Added DisplayPriority import and updated loadData method to sort posts based on display priority
src/main/webapp/app/shared/metis/posting-header/post-header/post-header.component.html Added conditional rendering to display a pushpin emoji for pinned posts

Assessment against linked issues

Objective Addressed Explanation
Pinned Message Persistence [#10024]
Visibility for All Participants [#10024]
Notification or Indicator [#10024] Pushpin emoji added to indicate pinned status

Possibly related PRs

Suggested labels

small, bugfix, ready to merge, component:Communication, tests

Suggested reviewers

  • HawKhiem
  • SimonEntholzer
  • krusche
  • eylulnc
  • asliayk

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@badkeyy badkeyy changed the title Enhance conversation and discussion sections to prioritize pinned pos… Communication: Improve visibility of pinned messages Jan 8, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/main/webapp/app/overview/discussion-section/discussion-section.component.ts (1)

94-105: Simplify the sorting logic for pinned posts.

The current implementation can be simplified to improve readability while maintaining the same functionality.

Consider this simpler implementation:

-            this.posts = posts
-                .slice()
-                .sort((a, b) => {
-                    if (a.displayPriority === DisplayPriority.PINNED && b.displayPriority !== DisplayPriority.PINNED) {
-                        return 1;
-                    }
-                    if (a.displayPriority !== DisplayPriority.PINNED && b.displayPriority === DisplayPriority.PINNED) {
-                        return -1;
-                    }
-                    return 0;
-                })
-                .reverse();
+            this.posts = posts
+                .slice()
+                .sort((a, b) => (b.displayPriority === DisplayPriority.PINNED ? 1 : 0) - (a.displayPriority === DisplayPriority.PINNED ? 1 : 0))
+                .reverse();
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1798b25 and 2a9f336.

📒 Files selected for processing (3)
  • src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts (3 hunks)
  • src/main/webapp/app/overview/discussion-section/discussion-section.component.ts (2 hunks)
  • src/main/webapp/app/shared/metis/posting-header/post-header/post-header.component.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/main/webapp/app/shared/metis/posting-header/post-header/post-header.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/app/overview/discussion-section/discussion-section.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

🔇 Additional comments (1)
src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts (1)

251-254: LGTM! Clean separation of pinned and unpinned posts.

The implementation correctly separates pinned posts and adds them at the beginning of the groups array, ensuring they appear at the top of the conversation.

Also applies to: 292-295

Copy link

@vinceclifford vinceclifford left a comment

Choose a reason for hiding this comment

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

Tested on TS5, works as expected.

Copy link

@sachmii sachmii left a comment

Choose a reason for hiding this comment

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

Tested on TS5, works as described.

Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

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

Tested on TS2. Works as described! However the change is only visible upon reload of the page!

Copy link

github-actions bot commented Jan 9, 2025

⚠️ Unable to deploy to test servers ⚠️

Testserver "artemis-test3.artemis.cit.tum.de" is already in use by PR #10114.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Jan 9, 2025
@SimonKaran13 SimonKaran13 added deploy:artemis-test5 and removed deployment-error Added by deployment workflows if an error occured labels Jan 9, 2025
@SimonKaran13 SimonKaran13 temporarily deployed to artemis-test5.artemis.cit.tum.de January 9, 2025 13:26 — with GitHub Actions Inactive
Copy link

@ahbitaqu ahbitaqu left a comment

Choose a reason for hiding this comment

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

[Tested on TS5]

Works as described!

Copy link

@SimonKaran13 SimonKaran13 left a comment

Choose a reason for hiding this comment

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

Tested on TS5, works as expected. Nice change :)
image

@badkeyy
Copy link
Contributor Author

badkeyy commented Jan 9, 2025

Tested on TS2. Works as described! However the change is only visible upon reload of the page!

This should not happen. So if you pin a post you have to reload the page in order to see the pinned post?

Copy link

@sawys777 sawys777 left a comment

Choose a reason for hiding this comment

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

Tested on TS1, the feature works as expected, however, sometimes reloading the page is necessary for the pinned message to be placed at the top

@krusche krusche merged commit 9c85d57 into develop Jan 12, 2025
108 of 116 checks passed
@krusche krusche deleted the feature/communication/improve-visibility-of-pinned-messages branch January 12, 2025 10:41
@krusche krusche added this to the 7.8.3 milestone Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) ready for review
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

Communictaion: Implement the Pin-Function
8 participants