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: Show send button within markdown editor only in communication #10427

Conversation

rabeatwork
Copy link
Contributor

@rabeatwork rabeatwork commented Feb 28, 2025

Checklist

General

Client

Motivation and Context

The send button below the markdown editor was mistakenly displayed in other areas outside the communication module, such as in programming exercises where the markdown editor is used, too. However, in these cases, the button does not make sense for the user.

Description

The send button is now conditionally displayed depending on whether the markdown editor is embedded within the communication module or not.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Student
  1. Log in to Artemis
  2. Navigate to Course Management
  3. Create a new progrmming exercise
  4. Scroll to the Problem Statement
  5. Verify that the Send button is not displayed
  6. Go to "Communication"
  7. Choose a direct message or group channel
  8. Verify that the send button is displayed

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

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

Test Coverage

Screenshots

Before:
Screenshot 2025-02-28 at 14 36 35
After:
Screenshot 2025-02-28 at 14 37 01

Summary by CodeRabbit

  • New Features
    • Updated the Markdown editor to display the send button only when in an active communication mode.
    • Enhanced the posting interface so that the editor automatically engages this communication mode during markdown submissions.

@rabeatwork rabeatwork requested a review from a team as a code owner February 28, 2025 13:42
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Feb 28, 2025
Copy link

coderabbitai bot commented Feb 28, 2025

Walkthrough

This pull request updates the MarkdownEditorMonacoComponent by introducing a new boolean input property, isInCommunication, with a default value of false. The component’s template is modified to render the send button only when the edit type is not UPDATE and the component is in communication. Additionally, the posting editor’s template has been updated to pass an explicit communication state (true) to the markdown editor component. No changes have been made to exported or public entities beyond this addition.

Changes

File(s) Change Summary
src/.../monaco/markdown-editor-monaco.component.html
src/.../posting-markdown-editor.component.html
In the markdown editor template, the condition for displaying the send button now includes a check for isInCommunication(). The posting editor HTML passes [isInCommunication]="true" to <jhi-markdown-editor-monaco>.
src/.../monaco/markdown-editor-monaco.component.ts Added a new input property isInCommunication: boolean with a default value of false to enable communication state tracking.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant C as MarkdownEditorMonacoComponent
    U->>C: Request editor rendering
    C->>C: Check (editType() !== EditType.UPDATE)
    C->>C: Check isInCommunication()
    alt Both conditions true
        C->>U: Render send button
    else Any condition false
        C->>U: Do not render send button
    end

Possibly related PRs

Suggested labels

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

Suggested reviewers

  • HawKhiem
  • FelberMartin
  • PaRangger
  • SimonEntholzer
  • krusche

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 86bc5e1 and 64288dd.

📒 Files selected for processing (3)
  • src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.html (2 hunks)
  • src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.ts (1 hunks)
  • src/main/webapp/app/shared/metis/posting-markdown-editor/posting-markdown-editor.component.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`src/main/webapp/**/*.html`: @if and @for are new and valid ...

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-markdown-editor/posting-markdown-editor.component.html
  • src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.html
`src/main/webapp/**/*.ts`: angular_style:https://angular.io/...

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/shared/markdown-editor/monaco/markdown-editor-monaco.component.ts
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Call Build Workflow / Build .war artifact
  • GitHub Check: Call Build Workflow / Build and Push Docker Image
  • GitHub Check: client-tests-selected
  • GitHub Check: server-tests
  • GitHub Check: client-tests
  • GitHub Check: server-style
  • GitHub Check: Analyse
🔇 Additional comments (4)
src/main/webapp/app/shared/metis/posting-markdown-editor/posting-markdown-editor.component.html (1)

27-27: Properly sets communication context for the markdown editor.

The addition of [isInCommunication]="true" ensures the markdown editor knows it's being used in a communication context, enabling conditional rendering of communication-specific elements like the send button. This change directly addresses the PR objective.

src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.html (2)

48-50: Correctly conditioned send button to only appear in communication.

The added isInCommunication() check ensures the send button only appears when the markdown editor is used in a communication context, preventing it from appearing in programming exercises and other non-communication contexts.


77-79: Consistent condition for send button in preview mode.

The same isInCommunication() check has been added to the preview mode send button, maintaining consistent behavior across both editor and preview modes.

src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.ts (1)

247-247: Added input property to track communication context.

The new isInCommunication input property with a default value of false allows explicit tracking of when the markdown editor is being used in a communication context. This is well-implemented using Angular's modern input() function and follows the coding guideline for camelCase property names.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
  • @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
Collaborator

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

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

In general this PR is fine. Although I'm unsure if we should continue having components that behave/display differently in different views. To me this feels like an anti pattern.

@rabeatwork rabeatwork changed the title Bugfix: Show send button within markdown editor only in communication Communication: Show send button within markdown editor only in communication Feb 28, 2025
@rabeatwork
Copy link
Contributor Author

In general this PR is fine. Although I'm unsure if we should continue having components that behave/display differently in different views. To me this feels like an anti pattern.

I see your point, but here it’s just about hiding/displaying a send button. Duplicating the whole editor for that would be overkill. Using @input() (or signal inputs) for such things is also pretty common and keeps everything reusable and clean.

@MaximilianAnzinger
Copy link
Collaborator

To me this screams for inheritance which apparently is a thing in Angular . But I'm not an UI-Expert 😄

Copy link

github-actions bot commented Mar 9, 2025

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Mar 9, 2025
@krusche krusche merged commit 06f2da4 into develop Mar 9, 2025
25 of 29 checks passed
@krusche krusche deleted the bugfix/communication/show-send-button-within-mark-down-editor-only-in-communication branch March 9, 2025 19:07
@krusche krusche added this to the 7.10.5 milestone Mar 9, 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!) stale
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants