-
Notifications
You must be signed in to change notification settings - Fork 23
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
Conversation
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. | TipsChat with CodeRabbit Bot (
|
There was a problem hiding this 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
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
toScopeState
in theinit_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 ofScoped
. Ensure that this change is compatible with the rest of the codebase.23-27: The function
hangle_msg_scroll
now takes aScopeState
parameter instead ofScoped
. 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 aScopeState
parameter instead ofScoped
. 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 parameterquickprofile_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
andrender_pending_messages_listener
functions now have an additionalon_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 inquickprofile_data
. It generates a script using theSHOW_CONTEXT
constant and the currentquickprofile_data
values, and sets theupdate_script
andidentity_profile
states. Ensure that theSHOW_CONTEXT
constant and thequickprofile_data
values are correctly defined and updated elsewhere in the codebase. Also, ensure that theupdate_script
andidentity_profile
states are used correctly in the rest of the codebase.143-147: The
GroupUsers
component now receivesquickprofile_data
as a prop. Ensure that this prop is correctly used in theGroupUsers
component.160-178: The
get_messages
andget_chatbar
components now receivequickprofile_data
as a prop. Ensure that this prop is correctly used in these components. TheQuickProfileContext
component is added withquick_profile_uuid
,update_script
, anddid_key
props. Ensure that these props are correctly used in theQuickProfileContext
component.ui/src/layouts/chats/presentation/chat/group_users.rs (7)
14-22: The
Props
struct has been updated to include a new fieldquickprofile_data
. Ensure that all instances ofProps
have been updated to include this new field.28-35: The
quickprofile_data
field is now being used in theGroupUsers
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
andcontext_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
andcontext_data
. Ensure that all instances ofFriendsProps
have been updated to include these new fields.134-141: The
render_friend
function now receives two additional parameters:is_dev
andcontext_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
andcontext_data
. Also, theoncontextmenu
event handler has been added to thediv
element andUserImage
component in therender_friend
function. Ensure that all instances ofFriendProps
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 thewarp::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 theQuickProfileProps
struct has been modified to be a reference toDID
. This change should not affect the functionality of the code, but it's important to ensure that all uses ofdid_key
are updated to handle it as a reference.46-50: A new variant
SendFriendRequest
has been added to theQuickProfileCmd
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 forQuickProfileCmd
.273-315: The handling of the
SendFriendRequest
command has been added. This includes sending the friend request usingwarp_cmd_tx
and handling the response. The error handling includes specific handling for thePublicKeyIsBlocked
error and a general error case. The user is notified of errors throughToastNotification
. 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.
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 I'm currently trying to replicate this again with |
UI Automated Tests execution is complete! You can find the test results report here |
that feature is not part of this pr though so we might create a separate issue for that |
There was a problem hiding this 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
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.
There was a problem hiding this 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
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.
There was a problem hiding this 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
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
andIdentity
have been added. Ensure that these are used in the code and are necessary.22-28: The type of
did_key
inQuickProfileProps
has been changed fromDID
to&DID
. Make sure that this change is reflected in all places wheredid_key
is used.46-50: A new variant
SendFriendRequest
has been added to theQuickProfileCmd
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 theToastNotification
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 thedisabled
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.
What this PR does 📖
Compose
component which allowsWhich issue(s) this PR fixes 🔨