All files / app/assets/javascripts/notes constants.js

100% Statements 31/31
100% Branches 0/0
100% Functions 0/0
100% Lines 31/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131      107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x 107x   107x   107x   107x             107x           107x                                     107x                                                                                                                                 107x  
import { STATUS_CLOSED, STATUS_OPEN, STATUS_REOPENED } from '~/issues/constants';
import { __, s__ } from '~/locale';
 
export const DISCUSSION_NOTE = 'DiscussionNote';
export const DIFF_NOTE = 'DiffNote';
export const DISCUSSION = 'discussion';
export const NOTE = 'note';
export const SYSTEM_NOTE = 'systemNote';
export const COMMENT = 'comment';
export const ISSUE_NOTEABLE_TYPE = 'Issue';
export const EPIC_NOTEABLE_TYPE = 'Epic';
export const MERGE_REQUEST_NOTEABLE_TYPE = 'MergeRequest';
export const SNIPPET_NOTEABLE_TYPE = 'Snippet';
export const DESIGN_NOTEABLE_TYPE = 'DesignManagement::Design';
export const COMMIT_NOTEABLE_TYPE = 'Commit';
export const INCIDENT_NOTEABLE_TYPE = 'INCIDENT'; // TODO: check if value can be converted to `Incident`
export const UNRESOLVE_NOTE_METHOD_NAME = 'delete';
export const RESOLVE_NOTE_METHOD_NAME = 'post';
export const DESCRIPTION_TYPE = 'changed the description';
export const DISCUSSION_FILTERS_DEFAULT_VALUE = 0;
export const COMMENTS_ONLY_FILTER_VALUE = 1;
export const HISTORY_ONLY_FILTER_VALUE = 2;
export const DISCUSSION_TAB_LABEL = 'show';
export const NOTE_UNDERSCORE = 'note_';
export const TIME_DIFFERENCE_VALUE = 10;
export const ASC = 'asc';
export const DESC = 'desc';
 
export const DISCUSSION_FETCH_TIMEOUT = 750;
 
export const FETCH_UPDATED_NOTES_DEBOUNCE_TIMEOUT = 750;
 
export const NOTEABLE_TYPE_MAPPING = {
  Issue: ISSUE_NOTEABLE_TYPE,
  MergeRequest: MERGE_REQUEST_NOTEABLE_TYPE,
  Epic: EPIC_NOTEABLE_TYPE,
  Incident: INCIDENT_NOTEABLE_TYPE,
};
 
export const DISCUSSION_FILTER_TYPES = {
  ALL: 'all',
  COMMENTS: 'comments',
  HISTORY: 'history',
};
 
export const toggleStateErrorMessage = {
  Epic: {
    [STATUS_CLOSED]: __('Something went wrong while reopening the epic. Please try again later.'),
    [STATUS_OPEN]: __('Something went wrong while closing the epic. Please try again later.'),
    [STATUS_REOPENED]: __('Something went wrong while closing the epic. Please try again later.'),
  },
  MergeRequest: {
    [STATUS_CLOSED]: __(
      'Something went wrong while reopening the merge request. Please try again later.',
    ),
    [STATUS_OPEN]: __(
      'Something went wrong while closing the merge request. Please try again later.',
    ),
    [STATUS_REOPENED]: __(
      'Something went wrong while closing the merge request. Please try again later.',
    ),
  },
};
 
export const MR_FILTER_OPTIONS = [
  {
    text: __('Approvals'),
    value: 'approval',
    systemNoteIcons: ['approval', 'unapproval', 'check'],
  },
  {
    text: __('Assignees & reviewers'),
    value: 'assignees_reviewers',
    noteText: [
      s__('IssuableEvents|requested review from'),
      s__('IssuableEvents|removed review request for'),
      s__('IssuableEvents|assigned to'),
      s__('IssuableEvents|unassigned'),
    ],
  },
  {
    text: __('Comments (from bots)'),
    value: 'bot_comments',
    bot: true,
  },
  {
    text: __('Comments (from users)'),
    value: 'comments',
    noteType: ['DiscussionNote', 'DiffNote'],
    individualNote: true,
    noteText: [s__('IssuableEvents|resolved all threads')],
  },
  {
    text: __('Commits & branches'),
    value: 'commit_branches',
    systemNoteIcons: ['commit', 'fork'],
  },
  {
    text: __('Edits'),
    value: 'edits',
    systemNoteIcons: ['pencil', 'task-done'],
  },
  {
    text: __('Labels'),
    value: 'labels',
    systemNoteIcons: ['label'],
  },
  {
    text: __('Lock status'),
    value: 'lock_status',
    systemNoteIcons: ['lock', 'lock-open'],
  },
  {
    text: __('Mentions'),
    value: 'mentions',
    systemNoteIcons: ['comment-dots'],
  },
  {
    text: __('Merge request status'),
    value: 'status',
    systemNoteIcons: ['git-merge', 'issue-close', 'issues', 'merge-request-close'],
  },
  {
    text: __('Tracking'),
    value: 'tracking',
    noteType: ['MilestoneNote'],
    systemNoteIcons: ['timer'],
  },
];
export const MR_FILTER_TRACKING_OPENED = 'user_clicks_comment_filter_dropdown';