mattermost-mobile-upstream/app/constants/classification.ts
Andre Vasconcelos 10207015a5
Classification Markings: Cached request timer and PSv2 Implementation (#9926)
* Added mechanism to prevent repeated classification calls via inmemory cache

* Adding version-aware forking of requests to new PSv2 API

* Addressing PR feedback

* Pushing fixes for cache issues with builds

* Resolving issues with banner vanishing when opening a channel
2026-08-13 15:24:07 +03:00

49 lines
2.4 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// ---------------------------------------------------------------------------
// Classification-markings constants
//
// The classification system uses two linked property-field "object types":
//
// 1. System field — drives the GLOBAL banner. Linked to the server-side
// template and inherits its options/colors.
// 2. Channel field — drives PER-CHANNEL banners. Also linked to the
// template and inherits its options/colors.
//
// Both fields share the same field name on the server and are distinguished
// only by their object_type ('system' vs 'channel'). They are also scoped
// server-side as system fields, so they share the same field-level target
// attributes (`target_type='system'`, `target_id=''`). Property *values* for
// the system field are stored on the dedicated system endpoint and use the
// sentinel target_id 'system'.
// ---------------------------------------------------------------------------
// Property-field group identifying all classification-markings entities.
export const CLASSIFICATIONS_GROUP_NAME = 'access_control';
// Field-level target attributes shared by system and channel fields.
// `target_type` is always 'system'; `target_id` is empty for system-scoped
// field definitions (the server canonicalizes both).
export const CLASSIFICATIONS_FIELD_TARGET_TYPE = 'system';
export const CLASSIFICATIONS_FIELD_TARGET_ID = '';
// Shared field name for both the system and channel classification fields.
export const CLASSIFICATIONS_FIELD_NAME = 'classification';
// System field — drives the global banner. Property *values* live on the
// dedicated system endpoint and use the sentinel target_id 'system'.
export const CLASSIFICATIONS_SYSTEM_OBJECT_TYPE = 'system';
export const CLASSIFICATIONS_SYSTEM_VALUE_TARGET_ID = 'system';
// Channel field — drives the per-channel banner.
export const CLASSIFICATIONS_CHANNEL_OBJECT_TYPE = 'channel';
// Actions stored on the linked fields' attrs.actions to control banner placement.
export const DISPLAY_BANNER_TOP = 'display_banner_top';
export const DISPLAY_BANNER_BOTTOM = 'display_banner_bottom';
// How long a successful classification-field fetch stays fresh in the in-memory
// cache before the global banner mount effect will request it again (1 hour).
export const CLASSIFICATION_BANNER_CACHE_TTL = 60 * 60 * 1000;