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: Highlight solution answer in thread #10069

Conversation

badkeyy
Copy link
Contributor

@badkeyy badkeyy commented Dec 23, 2024

Replaces this PR: #9998

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.

Motivation and Context

Implements #9934

Description

Add a solution badge to the resolving message of a thread.

Steps for Testing

Prerequisites:

  • 1 Course
  • 1 Instructor
  1. Log in to Artemis
  2. Go to the communication tab of any course
  3. Create a conversation (thread) with at least two answers
  4. Mark one answer as "Reply resovles the original message"
  5. Find that this message is now marked with the "Solution" badge

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

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Performance Tests

  • Test 1
  • Test 2

Screenshots

image

Summary by CodeRabbit

  • New Features

    • Introduced a badge indicating if a post resolves a particular issue, enhancing user context.
    • Added multilingual support for the new "Solution" label in both German and English.
  • Bug Fixes

    • Enhanced functionality to accurately determine the resolution status of posts.
  • Tests

    • Added a test case to verify the display of the solution badge when applicable.

@badkeyy badkeyy requested a review from a team as a code owner December 23, 2024 13:21
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Dec 23, 2024
@badkeyy badkeyy added feature communication Pull requests that affect the corresponding module ready for review labels Dec 23, 2024
Copy link

coderabbitai bot commented Dec 23, 2024

Walkthrough

The pull request introduces a new feature to display a "Solution" badge for posts that resolve a specific issue. This is implemented by adding a new method isResolvesPostSet() in the AnswerPostHeaderComponent, updating the component's HTML template to conditionally render the badge, and adding corresponding translation keys in both English and German localization files. A new test case is also added to verify the functionality of displaying the solution badge.

Changes

File Change Summary
src/main/webapp/app/shared/metis/posting-header/answer-post-header/answer-post-header.component.html Added conditional rendering of a solution badge using isResolvesPostSet() method
src/main/webapp/app/shared/metis/posting-header/answer-post-header/answer-post-header.component.ts Added isResolvesPostSet() method to check if a post resolves another post
src/main/webapp/i18n/de/metis.json Added German translation for resolvesPost as "Lösung"
src/main/webapp/i18n/en/metis.json Added English translation for resolvesPost as "Solution"
src/test/javascript/spec/component/shared/metis/postings-header/answer-post-header/answer-post-header.component.spec.ts Added new test case to verify solution badge display, imported By from Angular

Sequence Diagram

sequenceDiagram
    participant Component as AnswerPostHeaderComponent
    participant Posting as Posting Object
    participant Template as HTML Template

    Component->>Posting: Check resolvesPost property
    Component->>Component: isResolvesPostSet()
    alt Post Resolves Another Post
        Template->>Template: Render Solution Badge
    else Post Does Not Resolve
        Template->>Template: Hide Solution Badge
    end
Loading

Possibly related PRs

Suggested labels

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

Suggested reviewers

  • asliayk
  • HawKhiem
  • SimonEntholzer
  • florian-glombik
  • krusche
  • eylulnc

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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.

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: 0

🧹 Nitpick comments (2)
src/main/webapp/app/shared/metis/posting-header/answer-post-header/answer-post-header.component.ts (1)

31-35: Consider simplifying boolean checks.
While the current logic is correct, you could simplify the return statement by converting the property to a boolean directly, for example:
return !!this.posting.resolvesPost;

src/test/javascript/spec/component/shared/metis/postings-header/answer-post-header/answer-post-header.component.spec.ts (1)

96-104: Add an assertion for displayed text.
The test verifies that the “Solution” span is present, but consider adding an expectation that checks the actual displayed text, ensuring the translation or label is correct.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 97c0636 and b2f9440.

📒 Files selected for processing (5)
  • src/main/webapp/app/shared/metis/posting-header/answer-post-header/answer-post-header.component.html (1 hunks)
  • src/main/webapp/app/shared/metis/posting-header/answer-post-header/answer-post-header.component.ts (1 hunks)
  • src/main/webapp/i18n/de/metis.json (1 hunks)
  • src/main/webapp/i18n/en/metis.json (1 hunks)
  • src/test/javascript/spec/component/shared/metis/postings-header/answer-post-header/answer-post-header.component.spec.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/main/webapp/i18n/de/metis.json (1)

Pattern src/main/webapp/i18n/de/**/*.json: German language translations should be informal (dutzen) and should never be formal (sietzen). So the user should always be addressed with "du/dein" and never with "sie/ihr".

src/main/webapp/app/shared/metis/posting-header/answer-post-header/answer-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/shared/metis/posting-header/answer-post-header/answer-post-header.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/test/javascript/spec/component/shared/metis/postings-header/answer-post-header/answer-post-header.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

📓 Learnings (1)
src/test/javascript/spec/component/shared/metis/postings-header/answer-post-header/answer-post-header.component.spec.ts (1)
Learnt from: rabeatwork
PR: ls1intum/Artemis#9103
File: src/test/javascript/spec/component/shared/metis/postings-header/answer-post-header/answer-post-header.component.spec.ts:94-94
Timestamp: 2024-11-12T12:52:03.805Z
Learning: The `#today-flag` ID is only present in the test files and not in the actual component's HTML or TypeScript files.
🔇 Additional comments (4)
src/test/javascript/spec/component/shared/metis/postings-header/answer-post-header/answer-post-header.component.spec.ts (1)

25-25: Import usage is appropriate.
Importing By from @angular/platform-browser is standard practice for DOM queries in tests. No issues here.

src/main/webapp/app/shared/metis/posting-header/answer-post-header/answer-post-header.component.html (1)

41-49: Conditional rendering and localization look good.
Using the @if syntax conforms to the updated Angular template recommendations, and the localized strings are applied correctly.

src/main/webapp/i18n/en/metis.json (1)

139-139: Translation key addition is consistent.
The new “resolvesPost” key, “Solution,” aligns well with the rest of the file structure. No issues found.

src/main/webapp/i18n/de/metis.json (1)

139-139: LGTM! Translation is appropriate and follows guidelines.

The German translation "Lösung" for the solution badge is:

  • Concise and clear
  • Correctly placed in the post section
  • Uses informal language as required by guidelines
  • Aligns with the PR objective to highlight solution answers in threads

@badkeyy badkeyy marked this pull request as draft December 23, 2024 13:25
@badkeyy
Copy link
Contributor Author

badkeyy commented Dec 23, 2024

Has already been implemented

@badkeyy badkeyy closed this Dec 23, 2024
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!) communication Pull requests that affect the corresponding module feature ready for review tests
Projects
Status: Work In Progress
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants