Skip to content

Conversation

@nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Oct 31, 2024

🎯 Goal

Hide the " Leave Group" button/actions if the user doesnt have the permissions.

Original PR: #630 by @bpollman

Moved to this new branch in order for CI to run.

🛠 Implementation

NOTE: Depends on update to mocks main swift rep: GetStream/stream-chat-swift#3478

The code checks for"delete-channel" but not "leave-channel"

This new code

    public var shouldShowLeaveConversationButton: Bool {
        if channel.isDirectMessageChannel {
            return channel.ownCapabilities.contains(.deleteChannel)
        } else {
            return channel.ownCapabilities.contains(.leaveChannel)
        }
    }

properly reflect the existing logic that sets the leave/delete title here.

    public var leaveButtonTitle: String {
        if channel.isDirectMessageChannel {
            return L10n.Alert.Actions.deleteChannelTitle
        } else {
            return L10n.Alert.Actions.leaveGroupTitle
        }
    }

🧪 Testing

Describe the steps how this change can be tested (or why it can't be tested).

☑️ Checklist

  • I have signed the Stream CLA (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Affected documentation updated (docusaurus, tutorial, CMS (task created)

@nuno-vieira nuno-vieira requested a review from a team as a code owner October 31, 2024 12:11
@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Oct 31, 2024

SDK Size

title develop branch diff status
StreamChatSwiftUI 7.99 MB 7.99 MB 0 KB 🟢

@nuno-vieira nuno-vieira force-pushed the fix/leave-channel-permissions branch from 1604fb5 to 9b6d615 Compare October 31, 2024 12:49
@sonarqubecloud
Copy link

@nuno-vieira nuno-vieira merged commit 5fea4bc into develop Oct 31, 2024
11 checks passed
@nuno-vieira nuno-vieira deleted the fix/leave-channel-permissions branch October 31, 2024 15:20
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Nov 6, 2024
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.

4 participants