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

feat(groups): Quickprofile chat friend request #1453

Merged
merged 7 commits into from
Nov 9, 2023
Merged

Conversation

Flemmli97
Copy link
Collaborator

What this PR does 📖

  • Rewrites quickprofile a bit:
    • Moved up to chat Compose component which allows
      1. accesss from other chat components and
      2. Render on top of the needed group modal (and prob other too)
  • Adds the ability to open quick profile from the group modal. Edit group modal is purposefully excluded since that has other functionalities too
  • Adds the ability to send a friend request from the quick profile menu

Which issue(s) this PR fixes 🔨

Copy link

coderabbitai bot commented Nov 6, 2023

Walkthrough
## Walkthrough

The changes primarily focus on enhancing the group chat functionality by allowing users to send friend requests directly from the group chat member list. This is achieved by adding new translations, modifying existing functions, and introducing new components and commands. The user interface has been updated with new elements and styles to support this feature. Additionally, some changes have been made to replace the use of `Scoped` with `ScopeState` in certain functions.

## Changes

| File(s) | Change Summary |
| --- | --- |
| common/locales/en-US/main.ftl | Added new translations for "Send Friend Request" and "Pending Friend Request". |
| ui/src/layouts/chats/presentation/chat/group_users.rs<br>ui/src/layouts/chats/presentation/chat/mod.rs<br>ui/src/layouts/chats/presentation/messages/mod.rs<br>ui/src/layouts/chats/presentation/quick_profile/mod.rs | Added and modified functions to support sending friend requests from the group chat member list. Introduced new components, commands, and variables. Updated user interface elements. |
| ui/src/layouts/chats/presentation/messages/coroutines.rs<br>ui/src/layouts/chats/presentation/messages/effects.rs | Replaced the use of `Scoped` with `ScopeState` in certain functions. |
| ui/src/layouts/chats/presentation/style.scss | Added a new CSS class ".quick-profile-context" and a media query for ".modal-div-files-layout". |
| ui/src/layouts/chats/scripts/show_context.js | Modified the `xPadding` variable based on a new condition. |

## Assessment against linked issues (Beta)

| Objective | Addressed | Explanation |
| --- | --- | --- |
| Add ability to send a friend request from the group chat member list (#1422) || The changes include the addition of a new command `SendFriendRequest` and the modification of various functions and components to support this feature. |
| The feature should be accessible from the group chat member list view (#1422) || The `GroupUsers` function and the `render_friends` and `render_friend` functions have been updated to support this feature. |
| The user should also be able to send a friend request from another unspecified location (#1422) || It's unclear from the changes whether this objective has been addressed as the unspecified location is not mentioned in the changes. |

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@github-actions github-actions bot added Don't merge yet DO NOT MERGE Missing dev review Still needs to be reviewed by a dev labels Nov 6, 2023
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.

Review Status

Actionable comments generated: 2

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between bc981f6 and 0466ee7.
Files selected for processing (9)
  • common/locales/en-US/main.ftl (1 hunks)
  • ui/src/layouts/chats/presentation/chat/group_users.rs (7 hunks)
  • ui/src/layouts/chats/presentation/chat/mod.rs (4 hunks)
  • ui/src/layouts/chats/presentation/messages/coroutines.rs (3 hunks)
  • ui/src/layouts/chats/presentation/messages/effects.rs (1 hunks)
  • ui/src/layouts/chats/presentation/messages/mod.rs (3 hunks)
  • ui/src/layouts/chats/presentation/quick_profile/mod.rs (9 hunks)
  • ui/src/layouts/chats/presentation/style.scss (1 hunks)
  • ui/src/layouts/chats/scripts/show_context.js (1 hunks)
Files skipped from review due to trivial changes (2)
  • common/locales/en-US/main.ftl
  • ui/src/layouts/chats/presentation/style.scss
Additional comments: 24
ui/src/layouts/chats/presentation/messages/effects.rs (1)
  • 5-15: The change from Scoped to ScopeState in the init_msg_scroll function signature is a breaking change. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.
ui/src/layouts/chats/presentation/messages/coroutines.rs (3)
  • 9-12: The import statement has been updated to use ScopeState instead of Scoped. Ensure that this change is compatible with the rest of the codebase.

  • 23-27: The function hangle_msg_scroll now takes a ScopeState parameter instead of Scoped. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.

  • 322-326: The function handle_warp_commands now takes a ScopeState parameter instead of Scoped. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.

ui/src/layouts/chats/presentation/messages/mod.rs (3)
  • 40-44: Imports are well organized and follow the best practices.

  • 67-83: The get_messages function now accepts an additional parameter quickprofile_data. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, the function is now using shared state providers which is a good practice for managing state in a predictable way.

  • 136-160: The loop_over_message_groups and render_pending_messages_listener functions now have an additional on_context_menu_action event handler. This is likely related to the new quick profile feature. Ensure that the event handler is properly implemented and tested.

ui/src/layouts/chats/presentation/chat/mod.rs (3)
  • 48-68: The use_effect hook is used to handle changes in quickprofile_data. It generates a script using the SHOW_CONTEXT constant and the current quickprofile_data values, and sets the update_script and identity_profile states. Ensure that the SHOW_CONTEXT constant and the quickprofile_data values are correctly defined and updated elsewhere in the codebase. Also, ensure that the update_script and identity_profile states are used correctly in the rest of the codebase.

  • 143-147: The GroupUsers component now receives quickprofile_data as a prop. Ensure that this prop is correctly used in the GroupUsers component.

  • 160-178: The get_messages and get_chatbar components now receive quickprofile_data as a prop. Ensure that this prop is correctly used in these components. The QuickProfileContext component is added with quick_profile_uuid, update_script, and did_key props. Ensure that these props are correctly used in the QuickProfileContext component.

ui/src/layouts/chats/presentation/chat/group_users.rs (7)
  • 14-22: The Props struct has been updated to include a new field quickprofile_data. Ensure that all instances of Props have been updated to include this new field.

  • 28-35: The quickprofile_data field is now being used in the GroupUsers function. Ensure that the data being passed to this field is correctly formatted and sanitized.

  • 49-67: A new use_effect hook has been added to disable the default right-click actions on certain elements. This is a good practice for customizing the user experience, but make sure that this doesn't interfere with any other functionality.

  • 88-100: The render_friends function now receives two additional parameters: is_dev and context_data. Ensure that these parameters are being passed correctly wherever this function is called.

  • 104-111: The FriendsProps struct has been updated to include two new fields: is_dev and context_data. Ensure that all instances of FriendsProps have been updated to include these new fields.

  • 134-141: The render_friend function now receives two additional parameters: is_dev and context_data. Ensure that these parameters are being passed correctly wherever this function is called.

  • 156-178: The FriendProps struct has been updated to include two new fields: is_dev and context_data. Also, the oncontextmenu event handler has been added to the div element and UserImage component in the render_friend function. Ensure that all instances of FriendProps have been updated to include these new fields and that the event handler is functioning as expected.

ui/src/layouts/chats/presentation/quick_profile/mod.rs (7)
  • 10-15: The import of ToastNotification is new and is used for user feedback in case of errors. Ensure that the imported module is available and correctly referenced.

  • 22-26: The import of Error from the warp::error module is new and is used for error handling. Ensure that the imported module is available and correctly referenced.

  • 32-38: The did_key field in the QuickProfileProps struct has been modified to be a reference to DID. This change should not affect the functionality of the code, but it's important to ensure that all uses of did_key are updated to handle it as a reference.

  • 46-50: A new variant SendFriendRequest has been added to the QuickProfileCmd enum. This is used to handle the new functionality of sending friend requests. Ensure that this new variant is handled correctly in all match statements for QuickProfileCmd.

  • 273-315: The handling of the SendFriendRequest command has been added. This includes sending the friend request using warp_cmd_tx and handling the response. The error handling includes specific handling for the PublicKeyIsBlocked error and a general error case. The user is notified of errors through ToastNotification. This is a good practice as it provides feedback to the user.

  • 387-404: A new context item has been added to the context menu for sending a friend request. This includes checking if a friend request is already outgoing and disabling the option in that case. This is a good practice as it prevents the user from sending multiple friend requests to the same person.

  • 468-472: A new div with class "quick-profile-context" has been added to wrap the context menu. This likely relates to the styling adjustments mentioned in the PR summary. Ensure that the new CSS class is defined correctly in the stylesheet.

ui/src/layouts/chats/scripts/show_context.js Show resolved Hide resolved
ui/src/layouts/chats/scripts/show_context.js Show resolved Hide resolved
@phillsatellite
Copy link
Contributor

So when I tested I sent Hogans DID from my macbook account to my Windows account

When I first pasted it on my mac it said "User not found" I pasted again and worked and the original I sent updated along with it

On Windows side both messages with Hogans did that I sent just says "user not found" and never updated

image

image

I'm currently trying to replicate this again with trace-warp so I can send you the logs for it

@phillsatellite phillsatellite added the Changes requested When other dev or QA request a change label Nov 6, 2023
Copy link
Contributor

github-actions bot commented Nov 6, 2023

UI Automated Test Results Summary for MacOS/Windows

476 tests   266 ✔️  2h 29m 13s ⏱️
  41 suites  210 💤
    3 files        0

Results for commit df06e93.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Nov 6, 2023

UI Automated Tests execution is complete! You can find the test results report here

@Flemmli97
Copy link
Collaborator Author

So when I tested I sent Hogans DID from my macbook account to my Windows account

When I first pasted it on my mac it said "User not found" I pasted again and worked and the original I sent updated along with it

On Windows side both messages with Hogans did that I sent just says "user not found" and never updated

image

image

I'm currently trying to replicate this again with trace-warp so I can send you the logs for it

that feature is not part of this pr though so we might create a separate issue for that

@phillsatellite phillsatellite removed the Changes requested When other dev or QA request a change label Nov 6, 2023
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.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 0466ee7 and e443bf7.
Files selected for processing (1)
  • common/locales/en-US/main.ftl (1 hunks)
Additional comments: 1
common/locales/en-US/main.ftl (1)
  • 354-358: The new translations for "Send Friend Request" and "Pending Friend Request" are correctly added. Ensure that these translations are used in the appropriate places in the UI.

@phillsatellite phillsatellite added the QA Tested QA has tested and approved label Nov 6, 2023
@github-actions github-actions bot added the Failed Automated Test This PR is failing Luis's Appium test and needs revised label Nov 7, 2023
@github-actions github-actions bot removed the Failed Automated Test This PR is failing Luis's Appium test and needs revised label Nov 8, 2023
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.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between e443bf7 and ba419d3.
Files selected for processing (1)
  • common/locales/en-US/main.ftl (1 hunks)
Additional comments: 1
common/locales/en-US/main.ftl (1)
  • 357-361: The new UI elements "Send Friend Request" and "Pending Friend Request" are added correctly. Ensure that these new elements are properly localized for all supported languages.

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.

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between ba419d3 and df06e93.
Files selected for processing (1)
  • ui/src/layouts/chats/presentation/quick_profile/mod.rs (9 hunks)
Additional comments: 7
ui/src/layouts/chats/presentation/quick_profile/mod.rs (7)
  • 10-15: The new imports ToastNotification and Identity have been added. Ensure that these are used in the code and are necessary.

  • 22-28: The type of did_key in QuickProfileProps has been changed from DID to &DID. Make sure that this change is reflected in all places where did_key is used.

  • 46-50: A new variant SendFriendRequest has been added to the QuickProfileCmd enum. Ensure that this variant is handled in all match statements for this enum.

  • 80-87: The update_script is evaluated in an async block. Ensure that the script is safe to execute and that it doesn't block the main thread.

  • 273-312: The new SendFriendRequest command is handled here. The error handling and logging seem appropriate. However, ensure that the ToastNotification messages are displayed to the user in a user-friendly manner.

  • 387-404: The logic for sending a friend request has been added. Ensure that the outgoing variable correctly represents the outgoing friend requests and that the disabled variable correctly represents whether the friend request button should be disabled.

  • 471-475: The children prop is rendered at the end of the component. Ensure that this is the intended behavior and that the children are rendered correctly.

@sdwoodbury sdwoodbury merged commit bd75d2a into dev Nov 9, 2023
10 checks passed
@sdwoodbury sdwoodbury deleted the chat_friend_request branch November 9, 2023 18:37
@github-actions github-actions bot removed the QA Tested QA has tested and approved label Nov 9, 2023
@github-actions github-actions bot removed Missing dev review Still needs to be reviewed by a dev Don't merge yet DO NOT MERGE labels Nov 9, 2023
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.

feat(groups): add ability to FR someone from the group chat member list
5 participants