-
Notifications
You must be signed in to change notification settings - Fork 35
Fix extra issues groups #20
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
Merged
Bilb
merged 5 commits into
session-foundation:release/1.15.0
from
Bilb:fix-extra-issues-groups
Jan 9, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a8372f1
fix: show dialog before deleting group
Bilb 3e34b0f
fix: use more withs for onion.ts file
Bilb 53e5794
fix: do not schedule store update when deleting msgs
Bilb 2ca2dd4
fix: allow promoted state to be reset to NOT_SENT
Bilb 82abfed
fix: sorting order for group depending on statuses
Bilb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
ts/components/menu/items/LeaveAndDeleteGroup/LeaveGroupMenuItem.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,53 @@ | ||
function sharedEnabled({ | ||
isGroup, | ||
isPublic, | ||
isMessageRequestShown, | ||
}: Pick<Parameters<typeof showLeaveGroupItem>[0], 'isGroup' | 'isMessageRequestShown'>) { | ||
return isGroup && !isMessageRequestShown; | ||
}: Pick< | ||
Parameters<typeof showLeaveGroupItem>[0], | ||
'isGroup' | 'isMessageRequestShown' | 'isPublic' | ||
>) { | ||
return isGroup && !isMessageRequestShown && !isPublic; | ||
} | ||
|
||
/** | ||
* We can try leave a group if | ||
* - we are an admin of the group (that group would be marked as destroyed on delete) | ||
* and | ||
* - we are a **not kicked** member (if we are kicked without knowing about it and try to leave, we will silently remove the group) | ||
* | ||
* Note: Those actions are hidden if the group is a group request (as we have other buttons to accept/decline a group request). | ||
* | ||
* Note: If we fail to leave the group but that error is retryable, we will keep the group displaying the "leave" option. | ||
*/ | ||
export function showLeaveGroupItem({ | ||
isGroup, | ||
isPublic, | ||
isKickedFromGroup, | ||
isMessageRequestShown, | ||
lastMessageIsLeaveError, | ||
isGroupDestroyed, | ||
}: { | ||
isGroup: boolean; | ||
isPublic: boolean; | ||
isMessageRequestShown: boolean; | ||
lastMessageIsLeaveError: boolean; | ||
isKickedFromGroup: boolean; | ||
isGroupDestroyed: boolean; | ||
}) { | ||
// we can't try to leave the group if we were kicked from it, or if we've already tried to (lastMessageIsLeaveError is true) | ||
return ( | ||
sharedEnabled({ isGroup, isMessageRequestShown }) && | ||
sharedEnabled({ isGroup, isMessageRequestShown, isPublic }) && | ||
!isKickedFromGroup && | ||
!lastMessageIsLeaveError | ||
!isGroupDestroyed | ||
); | ||
} | ||
|
||
export function showDeleteGroupItem({ | ||
isGroup, | ||
isKickedFromGroup, | ||
isMessageRequestShown, | ||
lastMessageIsLeaveError, | ||
}: { | ||
/** | ||
* We can try to delete a group only if the `showLeaveGroupItem` returns false. | ||
* Note: those actions are hidden if the group is a group request (as we have other buttons to accept/decline a group request) | ||
*/ | ||
export function showDeleteGroupItem(args: { | ||
isGroup: boolean; | ||
isPublic: boolean; | ||
isMessageRequestShown: boolean; | ||
lastMessageIsLeaveError: boolean; | ||
isKickedFromGroup: boolean; | ||
isGroupDestroyed: boolean; | ||
}) { | ||
return ( | ||
sharedEnabled({ isGroup, isMessageRequestShown }) && | ||
(isKickedFromGroup || lastMessageIsLeaveError) | ||
); | ||
return sharedEnabled(args) && !showLeaveGroupItem(args); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.