mattermost-mobile/app/actions/remote/channel_access_control_attributes.ts
Pablo Vélez 1569f712d2
Mm 63935 abac end user indicators (#8848)
* MM-63935 - abac end user indicators

* rename policy variables to clearly indicate are from abac

* update attributes hook to cache processed data

* use policyEnforce property

* add missing type

* rename policy_enforced to abac_policy_enforced part 1

* add channel policy enforced type

* fix translation file

* remove unnecesary stop propagation

* use existing components

* remove unnecesary files

* fix snapshot

* update snapshot

* do not tie styles to the abac feature

* remove unnecesary margin top

* simplify props, add style for flat banner, remove unncesary index

* simplify condition, extract inline to component function

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2025-05-19 15:34:03 +02:00

26 lines
1,013 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import NetworkManager from '@managers/network_manager';
import {getFullErrorMessage} from '@utils/errors';
import {logDebug} from '@utils/log';
import {forceLogoutIfNecessary} from './session';
/**
* Fetches the channel access control attributes for a specific channel
* @param serverUrl - The server URL
* @param channelId - The ID of the channel
* @returns The channel access control attributes or an error
*/
export async function fetchChannelAccessControlAttributes(serverUrl: string, channelId: string) {
try {
const client = NetworkManager.getClient(serverUrl);
const attributes = await client.getChannelAccessControlAttributes(channelId);
return {attributes};
} catch (error) {
logDebug('error on fetchChannelAccessControlAttributes', getFullErrorMessage(error));
forceLogoutIfNecessary(serverUrl, error);
return {error};
}
}