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: Allow user to forward messages #9794

Open
wants to merge 106 commits into
base: develop
Choose a base branch
from

Conversation

asliayk
Copy link
Contributor

@asliayk asliayk commented Nov 16, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex database calls.
  • I strictly followed the principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).

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 multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Motivation and Context

Currently user cannot forward messages to other channels/direct-group chats.

(Closes #9066)

Description

The forward message feature has been added. Users can now navigate to the forward message dialog by clicking on the forward message option. They can select a random number of destinations and add content to the forwarded message (similar to Slack).

forwarded_message table has been added to the database with the following fields:

  • id: id of forwarded message
  • source_id: the id of the original message
  • source_type: the type of the original message (post or answer)
  • destination_post_id: the id of the destination post (the id of newly created post with the forwarded message)
  • destination_answer_id: the id of the destination answer post (the id of newly created answer post with the forwarded message)

post and answer_post table have been updated with a new column named has_forwarded_messages.

Known Issue for a followup PR:
The server-side changes for forwarding multiple messages within a single message and forwarding a message as a reply to another message (inside an AnswerPost) are already in place, but the client-side implementation is not ready yet. To achieve this, a unique message link needs to be generated for each post/answer post, similar to the "Copy Link" feature in Slack. This will be completed in a follow-up PR.

Steps for Testing

Prerequisites:

  • 1 Instructor/Student
  • 1 Course with Communication enabled
  1. Log in to Artemis.
  2. Navigate to the Communication section of a course.
  3. Select a random message to forward or create a new one. Click on the forward message option (available on its hover bar or in the dropdown menu when opened via right-click).
  4. Add some content to the forwarded message and select random destinations to forward the message.
  5. Go to the destination channels/user chats and observe the forwarded messages.

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

Performance Tests

  • Test 1
  • Test 2

Test Coverage

Client

Class/File Line Coverage Confirmation (assert/expect)
answer-post.model.ts 100%
forwarded-message.model.ts 93.33% ✅ ❌
post.model.ts 100%
posting.model.ts 100%
course-conversations.component.ts 84.74% ✅ ❌
forward-message-dialog.component.ts 90.29% ✅ ❌
conversation-messages.component.ts 79.84% ✅ ❌
answer-post.service.ts 100%
answer-post.component.ts 98.07% ✅ ❌
forwarded-message.service.ts 100%
forwarded-message.component.ts 94.11% ✅ ❌
metis.service.ts 83.39% ✅ ❌
post.service.ts 80% ✅ ❌
post.component.ts 89.43% ✅ ❌
answer-post-reactions-bar.component.ts 92.5% ✅ ❌
post-reactions-bar.component.ts 92.39% ✅ ❌
posting-reactions-bar.directive.ts 71.71% ✅ ❌
posting-thread.component.ts 92.3% ✅ ❌
posting.directive.ts 89.58% ✅ ❌

Screenshots

forwarded message view
image

forward message dialog
image

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added functionality to forward messages, including a new modal dialog for selecting channels and chats.
    • Introduced methods to retrieve messages by their IDs and manage forwarded messages.
    • Enhanced the Post and AnswerPost classes to track forwarded messages.
    • Added a new component for displaying forwarded messages.
    • Implemented a new method for batch retrieval of answer messages by their IDs.
    • Added a new endpoint for retrieving answer posts by their IDs.
    • Introduced a new DTO for grouping forwarded messages.
    • Added a new button for forwarding messages in various components.
    • Enhanced the ConversationMessagesComponent to handle forwarded messages and navigation.
    • Added new methods in MetisConversationService for creating group and direct conversations.
  • Bug Fixes

    • Improved error handling in message retrieval and forwarding functionalities.
  • Documentation

    • Updated UI elements and added tooltips for new features.
  • Style

    • Introduced new styles for the forward message dialog and related components.
  • Tests

    • Added tests for new functionalities related to message forwarding.
    • Enhanced test coverage for components managing forwarded messages.
  • Chores

    • Updated internationalization files to include translations for the forward message feature.

asliayk and others added 30 commits October 10, 2024 20:48
…e-message-view' into feature/communication/consecutive-message-view
…-view

# Conflicts:
#	src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts
#	src/main/webapp/app/shared/metis/answer-post/answer-post.component.scss
export class ForwardMessageDialogComponent implements OnInit, AfterViewInit {
channels = signal<ChannelDTO[] | []>([]);
users = signal<UserPublicInfoDTO[] | []>([]);
postToForward = signal<Post | null>(null);
Copy link
Member

Choose a reason for hiding this comment

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

we prefer undefined over null in the client code, see the client coding guidelines

}

@Component({
selector: 'jhi-forward-message-dialog',
Copy link
Member

Choose a reason for hiding this comment

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

why is the new component not standalone?

Copy link
Member

@krusche krusche left a comment

Choose a reason for hiding this comment

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

  1. we prefer undefined over null in the client code, see the client coding guidelines
  2. please make all new components standalone
  3. client tests need to pass (including test coverage)

…are-message' into feature/communication/forward-share-message
Copy link

github-actions bot commented Jan 6, 2025

⚠️ Unable to deploy to test servers ⚠️

Testserver "artemis-test4.artemis.cit.tum.de" is already in use by PR #9740.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Jan 6, 2025
@github-actions github-actions bot removed the deployment-error Added by deployment workflows if an error occured label Jan 6, 2025
@vinceclifford vinceclifford temporarily deployed to artemis-test5.artemis.cit.tum.de January 6, 2025 12:26 — with GitHub Actions Inactive
vinceclifford
vinceclifford previously approved these changes Jan 6, 2025
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!

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 component:Communication database Pull requests that update the database. (Added Automatically!). Require a CRITICAL deployment. feature server Pull requests that update Java code. (Added Automatically!) tests
Projects
Status: Ready For Review
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Communication: Forward Messages Feature