constants.jsx 44.3 KB
Newer Older
1
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
// See LICENSE.txt for license information.
3

4
/* eslint-disable no-magic-numbers */
5
import keyMirror from 'key-mirror';
6

7
8
9
10
import audioIcon from 'images/icons/audio.svg';
import codeIcon from 'images/icons/code.svg';
import excelIcon from 'images/icons/excel.svg';
import genericIcon from 'images/icons/generic.svg';
11
import patchIcon from 'images/icons/patch.png';
12
13
14
15
import pdfIcon from 'images/icons/pdf.svg';
import pptIcon from 'images/icons/ppt.svg';
import videoIcon from 'images/icons/video.svg';
import wordIcon from 'images/icons/word.svg';
16
17
18
import logoImage from 'images/logo_compact.png';
import githubIcon from 'images/themes/code_themes/github.png';
import monokaiIcon from 'images/themes/code_themes/monokai.png';
19
20
import solarizedDarkIcon from 'images/themes/code_themes/solarized-dark.png';
import solarizedLightIcon from 'images/themes/code_themes/solarized-light.png';
21
import mattermostThemeImage from 'images/themes/mattermost.png';
22
23
import mattermostDarkThemeImage from 'images/themes/mattermost_dark.png';
import defaultThemeImage from 'images/themes/organization.png';
24
import windows10ThemeImage from 'images/themes/windows_dark.png';
25
26
import logoWebhook from 'images/webhook_icon.jpg';

27
28
import Permissions from 'mattermost-redux/constants/permissions';

29
30
import {t} from 'utils/i18n';

31
32
import githubCSS from '!!file-loader?name=files/code_themes/[hash].[ext]!highlight.js/styles/github.css';

33
// eslint-disable-line import/order
34
35
import monokaiCSS from '!!file-loader?name=files/code_themes/[hash].[ext]!highlight.js/styles/monokai.css';

36
// eslint-disable-line import/order
37
38
import solarizedDarkCSS from '!!file-loader?name=files/code_themes/[hash].[ext]!highlight.js/styles/solarized-dark.css';

39
// eslint-disable-line import/order
40
import solarizedLightCSS from '!!file-loader?name=files/code_themes/[hash].[ext]!highlight.js/styles/solarized-light.css'; // eslint-disable-line import/order
41

42
export const SettingsTypes = {
43
    TYPE_TEXT: 'text',
44
    TYPE_LONG_TEXT: 'longtext',
45
    TYPE_NUMBER: 'number',
46
    TYPE_COLOR: 'color',
47
    TYPE_BOOL: 'bool',
48
    TYPE_PERMISSION: 'permission',
49
    TYPE_RADIO: 'radio',
50
    TYPE_BANNER: 'banner',
51
52
    TYPE_DROPDOWN: 'dropdown',
    TYPE_GENERATED: 'generated',
53
    TYPE_USERNAME: 'username',
54
55
    TYPE_BUTTON: 'button',
    TYPE_LANGUAGE: 'language',
56
    TYPE_JOBSTABLE: 'jobstable',
57
    TYPE_CUSTOM: 'custom',
58
59
};

60
export const Preferences = {
Chris's avatar
Chris committed
61
    CATEGORY_CHANNEL_OPEN_TIME: 'channel_open_time',
62
    CATEGORY_DIRECT_CHANNEL_SHOW: 'direct_channel_show',
63
    CATEGORY_GROUP_CHANNEL_SHOW: 'group_channel_show',
64
    CATEGORY_DISPLAY_SETTINGS: 'display_settings',
Chris's avatar
Chris committed
65
    CATEGORY_SIDEBAR_SETTINGS: 'sidebar_settings',
66
67
68
69
70
    CATEGORY_ADVANCED_SETTINGS: 'advanced_settings',
    TUTORIAL_STEP: 'tutorial_step',
    CHANNEL_DISPLAY_MODE: 'channel_display_mode',
    CHANNEL_DISPLAY_MODE_CENTERED: 'centered',
    CHANNEL_DISPLAY_MODE_FULL_SCREEN: 'full',
71
    CHANNEL_DISPLAY_MODE_DEFAULT: 'full',
72
73
74
75
    MESSAGE_DISPLAY: 'message_display',
    MESSAGE_DISPLAY_CLEAN: 'clean',
    MESSAGE_DISPLAY_COMPACT: 'compact',
    MESSAGE_DISPLAY_DEFAULT: 'clean',
76
77
    LINK_PREVIEW_DISPLAY: 'link_previews',
    LINK_PREVIEW_DISPLAY_DEFAULT: 'true',
78
79
80
    COLLAPSE_DISPLAY: 'collapse_previews',
    COLLAPSE_DISPLAY_DEFAULT: 'false',
    USE_MILITARY_TIME: 'use_military_time',
81
    USE_MILITARY_TIME_DEFAULT: 'false',
82
    CATEGORY_THEME: 'theme',
83
84
    CATEGORY_FLAGGED_POST: 'flagged_post',
    CATEGORY_NOTIFICATIONS: 'notifications',
85
    CATEGORY_FAVORITE_CHANNEL: 'favorite_channel',
86
87
88
    EMAIL_INTERVAL: 'email_interval',
    INTERVAL_IMMEDIATE: 30, // "immediate" is a 30 second interval
    INTERVAL_FIFTEEN_MINUTES: 15 * 60,
89
    INTERVAL_HOUR: 60 * 60,
90
    INTERVAL_NEVER: 0,
91
    NAME_NAME_FORMAT: 'name_format',
92
    CATEGORY_SYSTEM_NOTICE: 'system_notice',
93
94
95
96
97
98
99
100
101
};

export const ActionTypes = keyMirror({
    RECEIVED_ERROR: null,
    CLICK_CHANNEL: null,
    CREATE_CHANNEL: null,
    CREATE_POST: null,
    CREATE_COMMENT: null,
    POST_DELETED: null,
102
    POST_UPDATED: null,
103
104
105
106
    REMOVE_POST: null,

    RECEIVED_CHANNELS: null,
    RECEIVED_CHANNEL: null,
107
    RECEIVED_CHANNEL_MEMBER: null,
108
    RECEIVED_MORE_CHANNELS: null,
109
    RECEIVED_CHANNEL_STATS: null,
110
    RECEIVED_MY_CHANNEL_MEMBERS: null,
111
    RECEIVED_MEMBERS_IN_CHANNEL: null,
112
113
114
115
116

    FOCUS_POST: null,
    RECEIVED_POSTS: null,
    RECEIVED_FOCUSED_POST: null,
    RECEIVED_EDIT_POST: null,
117
    EDIT_POST: null,
118
    SELECT_POST: null,
119
120
121
    RECEIVED_POST_SELECTED: null,
    RECEIVED_MENTION_DATA: null,
    RECEIVED_ADD_MENTION: null,
Gabin Aureche's avatar
Gabin Aureche committed
122
123
    RECEIVED_POST_PINNED: null,
    RECEIVED_POST_UNPINNED: null,
124
125
    INCREASE_POST_VISIBILITY: null,
    LOADING_POSTS: null,
126

127
128
    UPDATE_RHS_STATE: null,
    UPDATE_RHS_SEARCH_TERMS: null,
129
    UPDATE_RHS_SEARCH_RESULTS_TERMS: null,
130

131
132
133
    SET_RHS_EXPANDED: null,
    TOGGLE_RHS_EXPANDED: null,

134
135
    UPDATE_MOBILE_VIEW: null,

136
137
    SEARCH_FLAGGED_POSTS_REQUEST: null,
    SEARCH_FLAGGED_POSTS_SUCCESS: null,
138
139
140
141
142
    SEARCH_FLAGGED_POSTS_FAILURE: null,

    SEARCH_PINNED_POSTS_REQUEST: null,
    SEARCH_PINNED_POSTS_SUCCESS: null,
    SEARCH_PINNED_POSTS_FAILURE: null,
143

144
    RECEIVED_PROFILES: null,
145
    RECEIVED_PROFILES_IN_TEAM: null,
146
    RECEIVED_PROFILES_NOT_IN_TEAM: null,
147
148
    RECEIVED_PROFILE: null,
    RECEIVED_PROFILES_IN_CHANNEL: null,
149
    RECEIVED_PROFILES_NOT_IN_CHANNEL: null,
150
    RECEIVED_PROFILES_WITHOUT_TEAM: null,
151
152
153
154
155
156
157
158
    RECEIVED_ME: null,
    RECEIVED_SESSIONS: null,
    RECEIVED_AUDITS: null,
    RECEIVED_TEAMS: null,
    RECEIVED_STATUSES: null,
    RECEIVED_PREFERENCE: null,
    RECEIVED_PREFERENCES: null,
    DELETED_PREFERENCES: null,
159
    RECEIVED_FILE_INFOS: null,
160
161
162
163
    RECEIVED_ANALYTICS: null,

    RECEIVED_INCOMING_WEBHOOKS: null,
    RECEIVED_INCOMING_WEBHOOK: null,
164
    UPDATED_INCOMING_WEBHOOK: null,
165
166
167
168
169
170
171
172
173
    REMOVED_INCOMING_WEBHOOK: null,
    RECEIVED_OUTGOING_WEBHOOKS: null,
    RECEIVED_OUTGOING_WEBHOOK: null,
    UPDATED_OUTGOING_WEBHOOK: null,
    REMOVED_OUTGOING_WEBHOOK: null,
    RECEIVED_COMMANDS: null,
    RECEIVED_COMMAND: null,
    UPDATED_COMMAND: null,
    REMOVED_COMMAND: null,
174
175
176
    RECEIVED_OAUTHAPPS: null,
    RECEIVED_OAUTHAPP: null,
    REMOVED_OAUTHAPP: null,
177
178
179
180
181
182

    RECEIVED_CUSTOM_EMOJIS: null,
    RECEIVED_CUSTOM_EMOJI: null,
    UPDATED_CUSTOM_EMOJI: null,
    REMOVED_CUSTOM_EMOJI: null,

183
184
185
186
    RECEIVED_REACTIONS: null,
    ADDED_REACTION: null,
    REMOVED_REACTION: null,

187
188
    RECEIVED_MSG: null,

189
    RECEIVED_TEAM: null,
190
191
    RECEIVED_MY_TEAM: null,
    CREATED_TEAM: null,
192
    UPDATE_TEAM: null,
193

194
195
196
197
    SET_NAVIGATION_BLOCKED: null,
    DEFER_NAVIGATION: null,
    CANCEL_NAVIGATION: null,
    CONFIRM_NAVIGATION: null,
198
199
200
201
202
203
    RECEIVED_CONFIG: null,
    RECEIVED_LOGS: null,
    RECEIVED_SERVER_AUDITS: null,
    RECEIVED_SERVER_COMPLIANCE_REPORTS: null,
    RECEIVED_ALL_TEAMS: null,
    RECEIVED_ALL_TEAM_LISTINGS: null,
204
    RECEIVED_MY_TEAM_MEMBERS: null,
enahum's avatar
enahum committed
205
    RECEIVED_MY_TEAMS_UNREAD: null,
206
207
    RECEIVED_MEMBERS_IN_TEAM: null,
    RECEIVED_TEAM_STATS: null,
208

209
210
211
    UPDATE_OPEN_GRAPH_METADATA: null,
    RECIVED_OPEN_GRAPH_METADATA: null,

212
213
    SHOW_SEARCH: null,

214
    TOGGLE_SHORTCUTS_MODAL: null,
215
216
217
218
219
    TOGGLE_IMPORT_THEME_MODAL: null,
    TOGGLE_DELETE_POST_MODAL: null,
    TOGGLE_GET_POST_LINK_MODAL: null,
    TOGGLE_GET_TEAM_INVITE_LINK_MODAL: null,
    TOGGLE_GET_PUBLIC_LINK_MODAL: null,
220
    TOGGLE_QUICK_SWITCH_MODAL: null,
221
    TOGGLE_CHANNEL_PURPOSE_UPDATE_MODAL: null,
222
    TOGGLE_CHANNEL_NAME_UPDATE_MODAL: null,
223
    TOGGLE_LEAVE_PRIVATE_CHANNEL_MODAL: null,
224
225
    SHOW_EDIT_POST_MODAL: null,
    HIDE_EDIT_POST_MODAL: null,
226
227
228
229
230
231

    SUGGESTION_PRETEXT_CHANGED: null,
    SUGGESTION_RECEIVED_SUGGESTIONS: null,
    SUGGESTION_CLEAR_SUGGESTIONS: null,
    SUGGESTION_COMPLETE_WORD: null,
    SUGGESTION_SELECT_NEXT: null,
232
233
    SUGGESTION_SELECT_PREVIOUS: null,

234
235
    BROWSER_CHANGE_FOCUS: null,

236
237
    EMOJI_POSTED: null,

238
239
240
241
    RECEIVED_PLUGIN_COMPONENT: null,
    REMOVED_PLUGIN_COMPONENT: null,
    RECEIVED_PLUGIN_POST_COMPONENT: null,
    REMOVED_PLUGIN_POST_COMPONENT: null,
242
243
    RECEIVED_WEBAPP_PLUGINS: null,
    RECEIVED_WEBAPP_PLUGIN: null,
244
245
246
    REMOVED_WEBAPP_PLUGIN: null,

    MODAL_OPEN: null,
247
248
    MODAL_CLOSE: null,

249
250
    POPOVER_MENTION_KEY_CLICK: null,

251
    SELECT_CHANNEL_WITH_MEMBER: null,
252

253
    INCREMENT_EMOJI_PICKER_PAGE: null,
254
255
256
257
258
259
260
261
262

    TOGGLE_LHS: null,
    OPEN_LHS: null,
    CLOSE_LHS: null,

    TOGGLE_RHS_MENU: null,
    OPEN_RHS_MENU: null,
    CLOSE_RHS_MENU: null,

263
    STORE_REHYDRATION_FAILED: null,
264
265

    DISMISS_NOTICE: null,
266

267
    SELECT_ATTACHMENT_MENU_ACTION: null,
268
269

    RECEIVED_TRANSLATIONS: null,
270
271
272

    INCREMENT_WS_ERROR_COUNT: null,
    RESET_WS_ERROR_COUNT: null,
273
274
});

275
276
277
278
279
export const ModalIdentifiers = {
    CHANNEL_INFO: 'channel_info',
    DELETE_CHANNEL: 'delete_channel',
    CHANNEL_NOTIFICATIONS: 'channel_notifications',
    CHANNEL_INVITE: 'channel_invite',
280
    CHANNEL_MEMBERS: 'channel_members',
281
    CREATE_DM_CHANNEL: 'create_dm_channel',
282
    EDIT_CHANNEL_HEADER: 'edit_channel_header',
283
    EDIT_CHANNEL_PURPOSE: 'edit_channel_purpose',
284
    DELETE_POST: 'delete_post',
285
    CONVERT_CHANNEL: 'convert_channel',
Stan Chan's avatar
Stan Chan committed
286
    RESET_STATUS: 'reset_status',
287
    LEAVE_TEAM: 'leave_team',
288
    RENAME_CHANNEL: 'rename_channel',
289
    USER_SETTINGS: 'user_settings',
290
    QUICK_SWITCH: 'quick_switch',
291
    REMOVED_FROM_CHANNEL: 'removed_from_channel',
292
    EMAIL_INVITE: 'email_invite',
293
    INTERACTIVE_DIALOG: 'interactive_dialog',
294
295
};

enahum's avatar
enahum committed
296
export const UserStatuses = {
Stan Chan's avatar
Stan Chan committed
297
    OUT_OF_OFFICE: 'ooo',
enahum's avatar
enahum committed
298
299
    OFFLINE: 'offline',
    AWAY: 'away',
300
    ONLINE: 'online',
301
    DND: 'dnd',
enahum's avatar
enahum committed
302
303
};

304
export const UserSearchOptions = {
305
    ALLOW_INACTIVE: 'allow_inactive',
306
    WITHOUT_TEAM: 'without_team',
307
308
};

enahum's avatar
enahum committed
309
310
311
312
export const SocketEvents = {
    POSTED: 'posted',
    POST_EDITED: 'post_edited',
    POST_DELETED: 'post_deleted',
313
    POST_UPDATED: 'post_updated',
314
    CHANNEL_CONVERTED: 'channel_converted',
315
    CHANNEL_CREATED: 'channel_created',
enahum's avatar
enahum committed
316
    CHANNEL_DELETED: 'channel_deleted',
317
    CHANNEL_UPDATED: 'channel_updated',
enahum's avatar
enahum committed
318
    CHANNEL_VIEWED: 'channel_viewed',
319
    CHANNEL_MEMBER_UPDATED: 'channel_member_updated',
enahum's avatar
enahum committed
320
321
    DIRECT_ADDED: 'direct_added',
    NEW_USER: 'new_user',
322
    ADDED_TO_TEAM: 'added_to_team',
323
    JOIN_TEAM: 'join_team',
enahum's avatar
enahum committed
324
    LEAVE_TEAM: 'leave_team',
enahum's avatar
enahum committed
325
    UPDATE_TEAM: 'update_team',
326
    DELETE_TEAM: 'delete_team',
enahum's avatar
enahum committed
327
328
329
    USER_ADDED: 'user_added',
    USER_REMOVED: 'user_removed',
    USER_UPDATED: 'user_updated',
330
    USER_ROLE_UPDATED: 'user_role_updated',
331
    MEMBERROLE_UPDATED: 'memberrole_updated',
332
333
334
    ROLE_ADDED: 'role_added',
    ROLE_REMOVED: 'role_removed',
    ROLE_UPDATED: 'role_updated',
enahum's avatar
enahum committed
335
336
    TYPING: 'typing',
    PREFERENCE_CHANGED: 'preference_changed',
337
338
    PREFERENCES_CHANGED: 'preferences_changed',
    PREFERENCES_DELETED: 'preferences_deleted',
enahum's avatar
enahum committed
339
340
341
    EPHEMERAL_MESSAGE: 'ephemeral_message',
    STATUS_CHANGED: 'status_change',
    HELLO: 'hello',
342
    REACTION_ADDED: 'reaction_added',
343
    REACTION_REMOVED: 'reaction_removed',
344
    EMOJI_ADDED: 'emoji_added',
345
346
    PLUGIN_ENABLED: 'plugin_enabled',
    PLUGIN_DISABLED: 'plugin_disabled',
347
348
    LICENSE_CHANGED: 'license_changed',
    CONFIG_CHANGED: 'config_changed',
349
    PLUGIN_STATUSES_CHANGED: 'plugin_statuses_changed',
350
    OPEN_DIALOG: 'open_dialog',
enahum's avatar
enahum committed
351
352
};

353
354
355
356
export const TutorialSteps = {
    INTRO_SCREENS: 0,
    POST_POPOVER: 1,
    CHANNEL_POPOVER: 2,
357
    MENU_POPOVER: 3,
358
    FINISHED: 999,
359
360
};

361
362
363
364
365
366
export const PostTypes = {
    JOIN_LEAVE: 'system_join_leave',
    JOIN_CHANNEL: 'system_join_channel',
    LEAVE_CHANNEL: 'system_leave_channel',
    ADD_TO_CHANNEL: 'system_add_to_channel',
    REMOVE_FROM_CHANNEL: 'system_remove_from_channel',
367
    ADD_REMOVE: 'system_add_remove',
368
369
370
371
    JOIN_TEAM: 'system_join_team',
    LEAVE_TEAM: 'system_leave_team',
    ADD_TO_TEAM: 'system_add_to_team',
    REMOVE_FROM_TEAM: 'system_remove_from_team',
372
373
    HEADER_CHANGE: 'system_header_change',
    DISPLAYNAME_CHANGE: 'system_displayname_change',
374
    CONVERT_CHANNEL: 'system_convert_channel',
375
376
    PURPOSE_CHANGE: 'system_purpose_change',
    CHANNEL_DELETED: 'system_channel_deleted',
377
    FAKE_PARENT_DELETED: 'system_fake_parent_deleted',
378
    EPHEMERAL: 'system_ephemeral',
379
    EPHEMERAL_ADD_TO_CHANNEL: 'system_ephemeral_add_to_channel',
380
    REMOVE_LINK_PREVIEW: 'remove_link_preview',
381
382
};

383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
export const StatTypes = keyMirror({
    TOTAL_USERS: null,
    TOTAL_PUBLIC_CHANNELS: null,
    TOTAL_PRIVATE_GROUPS: null,
    TOTAL_POSTS: null,
    TOTAL_TEAMS: null,
    TOTAL_FILE_POSTS: null,
    TOTAL_HASHTAG_POSTS: null,
    TOTAL_IHOOKS: null,
    TOTAL_OHOOKS: null,
    TOTAL_COMMANDS: null,
    TOTAL_SESSIONS: null,
    POST_PER_DAY: null,
    USERS_WITH_POSTS_PER_DAY: null,
    RECENTLY_ACTIVE_USERS: null,
    NEWLY_CREATED_USERS: null,
    TOTAL_WEBSOCKET_CONNECTIONS: null,
    TOTAL_MASTER_DB_CONNECTIONS: null,
    TOTAL_READ_DB_CONNECTIONS: null,
    DAILY_ACTIVE_USERS: null,
403
    MONTHLY_ACTIVE_USERS: null,
404
405
});

406
407
408
409
410
export const SearchUserTeamFilter = {
    ALL_USERS: '',
    NO_TEAM: 'no_team',
};

411
412
export const SearchTypes = keyMirror({
    SET_MODAL_SEARCH: null,
413
    SET_SYSTEM_USERS_SEARCH: null,
414
415
});

416
417
418
419
420
421
422
export const StorageTypes = keyMirror({
    SET_ITEM: null,
    REMOVE_ITEM: null,
    SET_GLOBAL_ITEM: null,
    REMOVE_GLOBAL_ITEM: null,
    CLEAR: null,
    ACTION_ON_GLOBAL_ITEMS_WITH_PREFIX: null,
423
    ACTION_ON_ITEMS_WITH_PREFIX: null,
424
    STORAGE_REHYDRATE: null,
425
426
});

427
export const StoragePrefixes = {
428
    EMBED_VISIBLE: 'isVisible_',
429
    COMMENT_DRAFT: 'comment_draft_',
430
    DRAFT: 'draft_',
431
432
    LOGOUT: '__logout__',
    LOGIN: '__login__',
433
    ANNOUNCEMENT: '__announcement__',
434
    LANDING_PAGE_SEEN: '__landingPageSeen__',
435
436
};

437
export const ErrorPageTypes = {
438
    LOCAL_STORAGE: 'local_storage',
439
    OAUTH_ACCESS_DENIED: 'oauth_access_denied',
440
441
    OAUTH_MISSING_CODE: 'oauth_missing_code',
    PAGE_NOT_FOUND: 'page_not_found',
442
    PERMALINK_NOT_FOUND: 'permalink_not_found',
443
444
    TEAM_NOT_FOUND: 'team_not_found',
    CHANNEL_NOT_FOUND: 'channel_not_found',
445
446
};

447
448
export const JobTypes = {
    DATA_RETENTION: 'data_retention',
Corey Hulen's avatar
Corey Hulen committed
449
    ELASTICSEARCH_POST_INDEXING: 'elasticsearch_post_indexing',
450
    LDAP_SYNC: 'ldap_sync',
451
    MESSAGE_EXPORT: 'message_export',
452
453
454
455
456
457
458
459
};

export const JobStatuses = {
    PENDING: 'pending',
    IN_PROGRESS: 'in_progress',
    SUCCESS: 'success',
    ERROR: 'error',
    CANCEL_REQUESTED: 'cancel_requested',
460
    CANCELED: 'canceled',
461
462
};

463
464
465
466
467
468
469
470
export const AnnouncementBarTypes = {
    ANNOUNCEMENT: 'announcement',
    CRITICAL: 'critical',
    DEVELOPER: 'developer',
    SUCCESS: 'success',
};

export const AnnouncementBarMessages = {
471
472
473
474
475
476
477
478
    EMAIL_VERIFICATION_REQUIRED: t('announcement_bar.error.email_verification_required'),
    EMAIL_VERIFIED: t('announcement_bar.notification.email_verified'),
    LICENSE_EXPIRED: t('announcement_bar.error.license_expired'),
    LICENSE_EXPIRING: t('announcement_bar.error.license_expiring'),
    LICENSE_PAST_GRACE: t('announcement_bar.error.past_grace'),
    PREVIEW_MODE: t('announcement_bar.error.preview_mode'),
    SITE_URL: t('announcement_bar.error.site_url'),
    WEBSOCKET_PORT_ERROR: t('channel_loader.socketError'),
479
480
};

481
482
483
484
485
export const VerifyEmailErrors = {
    FAILED_EMAIL_VERIFICATION: 'failed_email_verification',
    FAILED_USER_STATE_UPDATE: 'failed_update_user_state',
};

486
487
488
489
490
491
492
493
494
495
496
export const FileTypes = {
    IMAGE: 'image',
    AUDIO: 'audio',
    VIDEO: 'video',
    SPREADSHEET: 'spreadsheet',
    CODE: 'code',
    WORD: 'word',
    PRESENTATION: 'presentation',
    PDF: 'pdf',
    PATCH: 'patch',
    SVG: 'svg',
497
    OTHER: 'other',
498
499
};

500
501
502
503
export const NotificationLevels = {
    DEFAULT: 'default',
    ALL: 'all',
    MENTION: 'mention',
504
    NONE: 'none',
505
506
};

507
508
509
510
export const NotificationSections = {
    MARK_UNREAD: 'markUnread',
    DESKTOP: 'desktop',
    PUSH: 'push',
511
    NONE: '',
512
513
};

514
515
export const AdvancedSections = {
    CONTROL_SEND: 'advancedCtrlSend',
516
    CODE_BLOCK_ON_CTRL_ENTER: 'codeBlockOnCtrlEnter',
517
518
519
520
521
    FORMATTING: 'formatting',
    JOIN_LEAVE: 'joinLeave',
    PREVIEW_FEATURES: 'advancedPreviewFeatures',
};

522
523
524
525
export const RHSStates = {
    MENTION: 'mention',
    SEARCH: 'search',
    FLAG: 'flag',
526
    PIN: 'pin',
527
528
};

529
530
531
export const UploadStatuses = {
    LOADING: 'loading',
    COMPLETE: 'complete',
532
    DEFAULT: '',
533
534
};

535
536
537
export const GroupUnreadChannels = {
    DISABLED: 'disabled',
    DEFAULT_ON: 'default_on',
538
    DEFAULT_OFF: 'default_off',
539
540
};

541
542
543
544
545
export const SidebarChannelGroups = {
    UNREADS: 'unreads',
    FAVORITE: 'favorite',
};

546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
export const PermissionsScope = {
    [Permissions.INVITE_USER]: 'team_scope',
    [Permissions.ADD_USER_TO_TEAM]: 'team_scope',
    [Permissions.USE_SLASH_COMMANDS]: 'channel_scope',
    [Permissions.MANAGE_SLASH_COMMANDS]: 'team_scope',
    [Permissions.MANAGE_OTHERS_SLASH_COMMANDS]: 'team_scope',
    [Permissions.CREATE_PUBLIC_CHANNEL]: 'team_scope',
    [Permissions.CREATE_PRIVATE_CHANNEL]: 'team_scope',
    [Permissions.MANAGE_PUBLIC_CHANNEL_MEMBERS]: 'channel_scope',
    [Permissions.MANAGE_PRIVATE_CHANNEL_MEMBERS]: 'channel_scope',
    [Permissions.ASSIGN_SYSTEM_ADMIN_ROLE]: 'system_scope',
    [Permissions.MANAGE_ROLES]: 'system_scope',
    [Permissions.MANAGE_TEAM_ROLES]: 'team_scope',
    [Permissions.MANAGE_CHANNEL_ROLES]: 'chanel_scope',
    [Permissions.MANAGE_SYSTEM]: 'system_scope',
    [Permissions.CREATE_DIRECT_CHANNEL]: 'system_scope',
    [Permissions.CREATE_GROUP_CHANNEL]: 'system_scope',
    [Permissions.MANAGE_PUBLIC_CHANNEL_PROPERTIES]: 'channel_scope',
    [Permissions.MANAGE_PRIVATE_CHANNEL_PROPERTIES]: 'channel_scope',
    [Permissions.LIST_TEAM_CHANNELS]: 'team_scope',
    [Permissions.JOIN_PUBLIC_CHANNELS]: 'team_scope',
    [Permissions.DELETE_PUBLIC_CHANNEL]: 'channel_scope',
    [Permissions.DELETE_PRIVATE_CHANNEL]: 'channel_scope',
    [Permissions.EDIT_OTHER_USERS]: 'system_scope',
    [Permissions.READ_CHANNEL]: 'channel_scope',
    [Permissions.READ_PUBLIC_CHANNEL]: 'team_scope',
    [Permissions.ADD_REACTION]: 'channel_scope',
    [Permissions.REMOVE_REACTION]: 'channel_scope',
    [Permissions.REMOVE_OTHERS_REACTIONS]: 'channel_scope',
    [Permissions.PERMANENT_DELETE_USER]: 'system_scope',
    [Permissions.UPLOAD_FILE]: 'channel_scope',
    [Permissions.GET_PUBLIC_LINK]: 'system_scope',
    [Permissions.MANAGE_WEBHOOKS]: 'team_scope',
    [Permissions.MANAGE_OTHERS_WEBHOOKS]: 'team_scope',
    [Permissions.MANAGE_OAUTH]: 'system_scope',
    [Permissions.MANAGE_SYSTEM_WIDE_OAUTH]: 'system_scope',
    [Permissions.CREATE_POST]: 'channel_scope',
    [Permissions.CREATE_POST_PUBLIC]: 'channel_scope',
    [Permissions.EDIT_POST]: 'channel_scope',
    [Permissions.EDIT_OTHERS_POSTS]: 'channel_scope',
    [Permissions.DELETE_POST]: 'channel_scope',
    [Permissions.DELETE_OTHERS_POSTS]: 'channel_scope',
    [Permissions.REMOVE_USER_FROM_TEAM]: 'team_scope',
    [Permissions.CREATE_TEAM]: 'system_scope',
    [Permissions.MANAGE_TEAM]: 'team_scope',
    [Permissions.IMPORT_TEAM]: 'team_scope',
    [Permissions.VIEW_TEAM]: 'team_scope',
    [Permissions.LIST_USERS_WITHOUT_TEAM]: 'system_scope',
    [Permissions.CREATE_USER_ACCESS_TOKEN]: 'system_scope',
    [Permissions.READ_USER_ACCESS_TOKEN]: 'system_scope',
    [Permissions.REVOKE_USER_ACCESS_TOKEN]: 'system_scope',
    [Permissions.MANAGE_JOBS]: 'system_scope',
598
599
    [Permissions.MANAGE_EMOJIS]: 'team_scope',
    [Permissions.MANAGE_OTHERS_EMOJIS]: 'team_scope',
600
601
};

602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
export const DefaultRolePermissions = {
    all_users: [
        Permissions.CREATE_DIRECT_CHANNEL,
        Permissions.CREATE_GROUP_CHANNEL,
        Permissions.PERMANENT_DELETE_USER,
        Permissions.CREATE_TEAM,
        Permissions.LIST_TEAM_CHANNELS,
        Permissions.JOIN_PUBLIC_CHANNELS,
        Permissions.READ_PUBLIC_CHANNEL,
        Permissions.VIEW_TEAM,
        Permissions.CREATE_PUBLIC_CHANNEL,
        Permissions.MANAGE_PUBLIC_CHANNEL_PROPERTIES,
        Permissions.DELETE_PUBLIC_CHANNEL,
        Permissions.CREATE_PRIVATE_CHANNEL,
        Permissions.MANAGE_PRIVATE_CHANNEL_PROPERTIES,
        Permissions.DELETE_PRIVATE_CHANNEL,
        Permissions.INVITE_USER,
        Permissions.ADD_USER_TO_TEAM,
        Permissions.READ_CHANNEL,
        Permissions.ADD_REACTION,
        Permissions.REMOVE_REACTION,
        Permissions.MANAGE_PUBLIC_CHANNEL_MEMBERS,
        Permissions.UPLOAD_FILE,
        Permissions.GET_PUBLIC_LINK,
        Permissions.CREATE_POST,
        Permissions.USE_SLASH_COMMANDS,
        Permissions.MANAGE_PRIVATE_CHANNEL_MEMBERS,
        Permissions.DELETE_POST,
        Permissions.EDIT_POST,
631
        Permissions.MANAGE_EMOJIS,
632
633
634
635
636
    ],
    channel_admin: [
        Permissions.MANAGE_CHANNEL_ROLES,
    ],
    team_admin: [
637
        Permissions.EDIT_OTHERS_POSTS,
638
639
640
641
642
643
644
645
646
647
648
649
650
651
        Permissions.REMOVE_USER_FROM_TEAM,
        Permissions.MANAGE_TEAM,
        Permissions.IMPORT_TEAM,
        Permissions.MANAGE_TEAM_ROLES,
        Permissions.MANAGE_CHANNEL_ROLES,
        Permissions.MANAGE_OTHERS_WEBHOOKS,
        Permissions.MANAGE_SLASH_COMMANDS,
        Permissions.MANAGE_OTHERS_SLASH_COMMANDS,
        Permissions.MANAGE_WEBHOOKS,
        Permissions.DELETE_POST,
        Permissions.DELETE_OTHERS_POSTS,
    ],
};

652
export const Constants = {
653
    SettingsTypes,
654
    JobTypes,
655
    Preferences,
enahum's avatar
enahum committed
656
    SocketEvents,
657
    ActionTypes,
enahum's avatar
enahum committed
658
    UserStatuses,
659
    UserSearchOptions,
660
    TutorialSteps,
661
    PostTypes,
662
    ErrorPageTypes,
663
664
    AnnouncementBarTypes,
    AnnouncementBarMessages,
665
    FileTypes,
666

667
668
    MAX_POST_VISIBILITY: 1000000,

669
    IGNORE_POST_TYPES: [PostTypes.JOIN_LEAVE, PostTypes.JOIN_TEAM, PostTypes.LEAVE_TEAM, PostTypes.JOIN_CHANNEL, PostTypes.LEAVE_CHANNEL, PostTypes.REMOVE_FROM_CHANNEL, PostTypes.ADD_REMOVE],
670
671
672

    PayloadSources: keyMirror({
        SERVER_ACTION: null,
673
        VIEW_ACTION: null,
674
675
    }),

676
    StatTypes,
677
678
679
    STAT_MAX_ACTIVE_USERS: 20,
    STAT_MAX_NEW_USERS: 20,

680
681
682
683
684
    ScrollTypes: {
        FREE: 1,
        BOTTOM: 2,
        SIDEBBAR_OPEN: 3,
        NEW_MESSAGE: 4,
685
        POST: 5,
686
687
    },

688
    SPECIAL_MENTIONS: ['all', 'channel', 'here'],
689
    NOTIFY_ALL_MEMBERS: 5,
690
    DEFAULT_CHARACTER_LIMIT: 4000,
691
    IMAGE_TYPE_GIF: 'gif',
692
    IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png', 'jpeg'],
693
    AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac', 'ogg', 'm4r'],
694
695
696
697
    VIDEO_TYPES: ['mp4', 'avi', 'webm', 'mkv', 'wmv', 'mpg', 'mov', 'flv'],
    PRESENTATION_TYPES: ['ppt', 'pptx'],
    SPREADSHEET_TYPES: ['xlsx', 'csv'],
    WORD_TYPES: ['doc', 'docx'],
Jazz's avatar
Jazz committed
698
    CODE_TYPES: ['as', 'applescript', 'osascript', 'scpt', 'bash', 'sh', 'zsh', 'clj', 'boot', 'cl2', 'cljc', 'cljs', 'cljs.hl', 'cljscm', 'cljx', 'hic', 'coffee', '_coffee', 'cake', 'cjsx', 'cson', 'iced', 'cpp', 'c', 'cc', 'h', 'c++', 'h++', 'hpp', 'cs', 'csharp', 'css', 'd', 'di', 'dart', 'delphi', 'dpr', 'dfm', 'pas', 'pascal', 'freepascal', 'lazarus', 'lpr', 'lfm', 'diff', 'django', 'jinja', 'dockerfile', 'docker', 'erl', 'f90', 'f95', 'fsharp', 'fs', 'gcode', 'nc', 'go', 'groovy', 'handlebars', 'hbs', 'html.hbs', 'html.handlebars', 'hs', 'hx', 'java', 'jsp', 'js', 'jsx', 'json', 'jl', 'kt', 'ktm', 'kts', 'less', 'lisp', 'lua', 'mk', 'mak', 'md', 'mkdown', 'mkd', 'matlab', 'm', 'mm', 'objc', 'obj-c', 'ml', 'perl', 'pl', 'php', 'php3', 'php4', 'php5', 'php6', 'ps', 'ps1', 'pp', 'py', 'gyp', 'r', 'ruby', 'rb', 'gemspec', 'podspec', 'thor', 'irb', 'rs', 'scala', 'scm', 'sld', 'scss', 'st', 'styl', 'sql', 'swift', 'tex', 'txt', 'vbnet', 'vb', 'bas', 'vbs', 'v', 'veo', 'xml', 'html', 'xhtml', 'rss', 'atom', 'xsl', 'plist', 'yaml'],
699
700
    PDF_TYPES: ['pdf'],
    PATCH_TYPES: ['patch'],
Yusuke Nemoto's avatar
Yusuke Nemoto committed
701
    SVG_TYPES: ['svg'],
702
703
704
705
706
707
708
709
710
    ICON_FROM_TYPE: {
        audio: audioIcon,
        video: videoIcon,
        spreadsheet: excelIcon,
        presentation: pptIcon,
        pdf: pdfIcon,
        code: codeIcon,
        word: wordIcon,
        patch: patchIcon,
711
        other: genericIcon,
712
713
714
715
716
717
718
719
720
721
    },
    ICON_NAME_FROM_TYPE: {
        audio: 'audio',
        video: 'video',
        spreadsheet: 'excel',
        presentation: 'ppt',
        pdf: 'pdf',
        code: 'code',
        word: 'word',
        patch: 'patch',
722
        other: 'generic',
723
        image: 'image',
724
725
    },
    MAX_UPLOAD_FILES: 5,
726
    MAX_FILENAME_LENGTH: 35,
727
728
729
730
731
732
    THUMBNAIL_WIDTH: 128,
    THUMBNAIL_HEIGHT: 100,
    WEB_VIDEO_WIDTH: 640,
    WEB_VIDEO_HEIGHT: 480,
    MOBILE_VIDEO_WIDTH: 480,
    MOBILE_VIDEO_HEIGHT: 360,
733
734
735
    MOBILE_SCREEN_WIDTH: 768,
    SCROLL_DELAY: 2000,
    SCROLL_PAGE_FRACTION: 3,
736
    DEFAULT_CHANNEL: 'town-square',
737
    DEFAULT_CHANNEL_UI_NAME: 'Town Square',
738
    OFFTOPIC_CHANNEL: 'off-topic',
739
    OFFTOPIC_CHANNEL_UI_NAME: 'Off-Topic',
740
    GITLAB_SERVICE: 'gitlab',
741
    PHABRICATOR_SERVICE: 'phabricator',
742
    GOOGLE_SERVICE: 'google',
743
    OFFICE365_SERVICE: 'office365',
744
    EMAIL_SERVICE: 'email',
JoramWilander's avatar
JoramWilander committed
745
    LDAP_SERVICE: 'ldap',
enahum's avatar
enahum committed
746
    SAML_SERVICE: 'saml',
JoramWilander's avatar
JoramWilander committed
747
    USERNAME_SERVICE: 'username',
748
    SIGNIN_CHANGE: 'signin_change',
749
    PASSWORD_CHANGE: 'password_change',
750
751
    GET_TERMS_ERROR: 'get_terms_error',
    TERMS_REJECTED: 'terms_rejected',
752
    SIGNIN_VERIFIED: 'verified',
753
    CREATE_LDAP: 'create_ldap',
754
755
    SESSION_EXPIRED: 'expired',
    POST_CHUNK_SIZE: 60,
756
    PROFILE_CHUNK_SIZE: 100,
757
758
759
760
    POST_FOCUS_CONTEXT_RADIUS: 10,
    POST_LOADING: 'loading',
    POST_FAILED: 'failed',
    POST_DELETED: 'deleted',
761
    POST_UPDATED: 'updated',
762
    SYSTEM_MESSAGE_PREFIX: 'system_',
Stan Chan's avatar
Stan Chan committed
763
    AUTO_RESPONDER: 'system_auto_responder',
764
765
    SYSTEM_MESSAGE_PROFILE_IMAGE: logoImage,
    RESERVED_TEAM_NAMES: [
766
767
        'signup',
        'login',
768
769
770
        'admin',
        'channel',
        'post',
771
        'api',
772
        'oauth',
773
774
775
776
    ],
    RESERVED_USERNAMES: [
        'valet',
        'all',
777
        'channel',
778
        'here',
779
        'matterbot',
780
        'system',
781
782
783
    ],
    MONTHS: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
    MAX_DMS: 20,
784
785
    MAX_USERS_IN_GM: 8,
    MIN_USERS_IN_GM: 3,
786
787
    MAX_CHANNEL_POPOVER_COUNT: 100,
    DM_CHANNEL: 'D',
788
    GM_CHANNEL: 'G',
789
790
    OPEN_CHANNEL: 'O',
    PRIVATE_CHANNEL: 'P',
791
    ARCHIVED_CHANNEL: 'archive',
792
793
794
795
796
797
    INVITE_TEAM: 'I',
    OPEN_TEAM: 'O',
    MAX_POST_LEN: 4000,
    EMOJI_SIZE: 16,
    THEMES: {
        default: {
Asaad Mahmood's avatar
Asaad Mahmood committed
798
799
800
801
802
803
804
805
806
807
808
            type: 'Mattermost',
            sidebarBg: '#145dbf',
            sidebarText: '#ffffff',
            sidebarUnreadText: '#ffffff',
            sidebarTextHoverBg: '#4578bf',
            sidebarTextActiveBorder: '#579eff',
            sidebarTextActiveColor: '#ffffff',
            sidebarHeaderBg: '#1153ab',
            sidebarHeaderTextColor: '#ffffff',
            onlineIndicator: '#06d6a0',
            awayIndicator: '#ffbc42',
809
            dndIndicator: '#f74343',
810
            mentionBg: '#ffffff',
Asaad Mahmood's avatar
Asaad Mahmood committed
811
812
813
814
815
816
817
818
            mentionColor: '#145dbf',
            centerChannelBg: '#ffffff',
            centerChannelColor: '#3d3c40',
            newMessageSeparator: '#ff8800',
            linkColor: '#2389d7',
            buttonBg: '#166de0',
            buttonColor: '#ffffff',
            errorTextColor: '#fd5960',
Asaad Mahmood's avatar
Asaad Mahmood committed
819
            mentionHighlightBg: '#ffe577',
Asaad Mahmood's avatar
Asaad Mahmood committed
820
821
            mentionHighlightLink: '#166de0',
            codeTheme: 'github',
822
            image: mattermostThemeImage,
Asaad Mahmood's avatar
Asaad Mahmood committed
823
824
        },
        organization: {
825
826
            type: 'Organization',
            sidebarBg: '#2071a7',
827
828
            sidebarText: '#ffffff',
            sidebarUnreadText: '#ffffff',
829
            sidebarTextHoverBg: '#136197',
830
831
            sidebarTextActiveBorder: '#7ab0d6',
            sidebarTextActiveColor: '#ffffff',
832
            sidebarHeaderBg: '#2f81b7',
833
834
835
            sidebarHeaderTextColor: '#ffffff',
            onlineIndicator: '#7dbe00',
            awayIndicator: '#dcbd4e',
836
            dndIndicator: '#ff6a6a',
837
            mentionBg: '#fbfbfb',
838
            mentionColor: '#2071f7',
839
840
            centerChannelBg: '#f2f4f8',
            centerChannelColor: '#333333',
841
            newMessageSeparator: '#ff8800',
842
843
            linkColor: '#2f81b7',
            buttonBg: '#1dacfc',
844
            buttonColor: '#ffffff',
Asaad Mahmood's avatar
Asaad Mahmood committed
845
            errorTextColor: '#a94442',
846
            mentionHighlightBg: '#f3e197',
847
848
            mentionHighlightLink: '#2f81b7',
            codeTheme: 'github',
849
            image: defaultThemeImage,
850
851
852
        },
        mattermostDark: {
            type: 'Mattermost Dark',
853
854
855
856
857
858
859
860
            sidebarBg: '#1b2c3e',
            sidebarText: '#ffffff',
            sidebarUnreadText: '#ffffff',
            sidebarTextHoverBg: '#4a5664',
            sidebarTextActiveBorder: '#66b9a7',
            sidebarTextActiveColor: '#ffffff',
            sidebarHeaderBg: '#1b2c3e',
            sidebarHeaderTextColor: '#ffffff',
861
862
            onlineIndicator: '#65dcc8',
            awayIndicator: '#c1b966',
863
            dndIndicator: '#e81023',
864
            mentionBg: '#b74a4a',
865
866
867
            mentionColor: '#ffffff',
            centerChannelBg: '#2f3e4e',
            centerChannelColor: '#dddddd',
868
            newMessageSeparator: '#5de5da',
869
870
871
            linkColor: '#a4ffeb',
            buttonBg: '#4cbba4',
            buttonColor: '#ffffff',
Asaad Mahmood's avatar
Asaad Mahmood committed
872
            errorTextColor: '#ff6461',
873
            mentionHighlightBg: '#984063',
874
            mentionHighlightLink: '#a4ffeb',
875
            codeTheme: 'solarized-dark',
876
            image: mattermostDarkThemeImage,
877
878
879
880
        },
        windows10: {
            type: 'Windows Dark',
            sidebarBg: '#171717',
881
882
            sidebarText: '#ffffff',
            sidebarUnreadText: '#ffffff',
883
            sidebarTextHoverBg: '#302e30',
884
885
            sidebarTextActiveBorder: '#196caf',
            sidebarTextActiveColor: '#ffffff',
886
            sidebarHeaderBg: '#1f1f1f',
887
            sidebarHeaderTextColor: '#ffffff',
888
889
            onlineIndicator: '#399fff',
            awayIndicator: '#c1b966',
890
            dndIndicator: '#e81023',
891
            mentionBg: '#0177e7',
892
893
894
895
896
            mentionColor: '#ffffff',
            centerChannelBg: '#1f1f1f',
            centerChannelColor: '#dddddd',
            newMessageSeparator: '#cc992d',
            linkColor: '#0d93ff',
897
            buttonBg: '#0177e7',
898
            buttonColor: '#ffffff',
Asaad Mahmood's avatar
Asaad Mahmood committed
899
            errorTextColor: '#ff6461',
900
            mentionHighlightBg: '#784098',
901
            mentionHighlightLink: '#a4ffeb',
902
            codeTheme: 'monokai',
903
904
            image: windows10ThemeImage,
        },
905
906
907
908
909
    },
    THEME_ELEMENTS: [
        {
            group: 'sidebarElements',
            id: 'sidebarBg',
910
            uiName: 'Sidebar BG',
911
912
913
914
        },
        {
            group: 'sidebarElements',
            id: 'sidebarText',
915
            uiName: 'Sidebar Text',
916
917
918
919
        },
        {
            group: 'sidebarElements',
            id: 'sidebarHeaderBg',
920
            uiName: 'Sidebar Header BG',
921
922
923
924
        },
        {
            group: 'sidebarElements',
            id: 'sidebarHeaderTextColor',
925
            uiName: 'Sidebar Header Text',
926
927
928
929
        },
        {
            group: 'sidebarElements',
            id: 'sidebarUnreadText',
930
            uiName: 'Sidebar Unread Text',
931
932
933
934
        },
        {
            group: 'sidebarElements',
            id: 'sidebarTextHoverBg',
935
            uiName: 'Sidebar Text Hover BG',
936
937
938
939
        },
        {
            group: 'sidebarElements',
            id: 'sidebarTextActiveBorder',
940
            uiName: 'Sidebar Text Active Border',
941
942
943
944
        },
        {
            group: 'sidebarElements',
            id: 'sidebarTextActiveColor',
945
            uiName: 'Sidebar Text Active Color',
946
947
948
949
        },
        {
            group: 'sidebarElements',
            id: 'onlineIndicator',
950
            uiName: 'Online Indicator',
951
952
953
954
        },
        {
            group: 'sidebarElements',
            id: 'awayIndicator',
955
            uiName: 'Away Indicator',
956
        },
957
958
959
        {
            group: 'sidebarElements',
            id: 'dndIndicator',