Skip to content

Commit

Permalink
feat: [CO-1547] add msg move constrains in move conversation action
Browse files Browse the repository at this point in the history
  • Loading branch information
keshavbhatt committed Nov 11, 2024
1 parent 66a2bda commit 5fe3bfd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ export const MAIL_SENSITIVITY_HEADER = {
companyConfidential: 'Company-Confidential'
} as const;

export const MAIL_SENSITIVITY_HEADER_VALUES = ['Personal', 'Private', 'Company-Confidential'];

export const SENSITIVITY_VALUES = ['Private', 'Company-Confidential'] as const;
export const VALID_MAIL_AUTHENTICATION_HEADERS = ['dkim', 'spf', 'dmarc'] as const;
export const CONV_ACTION_CONSTRAINS = '-stdj';
6 changes: 4 additions & 2 deletions src/store/actions/conv-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { createAsyncThunk } from '@reduxjs/toolkit';
import { soapFetch } from '@zextras/carbonio-shell-ui';
import { isNil } from 'lodash';

import { omitBy } from '../../commons/utils';
import type {
ConvActionParameters,
Expand All @@ -16,7 +17,7 @@ import type {

export const convAction = createAsyncThunk<ConvActionResult, ConvActionParameters>(
'convAction',
async ({ ids, operation, parent, tagName }) => {
async ({ ids, operation, parent, tagName, constrains }) => {
const { action } = (await soapFetch<ConvActionRequest, ConvActionResponse>('ConvAction', {

Check warning on line 21 in src/store/actions/conv-action.ts

View check run for this annotation

Sonarqube Zextras / carbonio-mails-ui Sonarqube Results

src/store/actions/conv-action.ts#L21

This assertion is unnecessary since it does not change the type of the expression.
_jsns: 'urn:zimbraMail',

Expand All @@ -25,7 +26,8 @@ export const convAction = createAsyncThunk<ConvActionResult, ConvActionParameter
id: ids.join(','),
op: operation,
l: parent,
tn: tagName
tn: tagName,
tcon: constrains
},
isNil
)
Expand Down
1 change: 1 addition & 0 deletions src/types/conversations/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export type ConvActionParameters = {
operation: ConvActionOperation;
parent?: string;
tagName?: string;
constrains?: string;
};

export type ConvActionResult = {
Expand Down
4 changes: 3 additions & 1 deletion src/ui-actions/move-conv-msg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useTranslation } from 'react-i18next';
import ModalFooter from '../carbonio-ui-commons/components/modals/modal-footer';
import ModalHeader from '../carbonio-ui-commons/components/modals/modal-header';
import { Folder } from '../carbonio-ui-commons/types/folder';
import { CONV_ACTION_CONSTRAINS } from '../constants';
import { isRoot } from '../helpers/folders';
import { useUiUtilities } from '../hooks/use-ui-utilities';
import { convAction, msgAction } from '../store/actions';
Expand Down Expand Up @@ -58,7 +59,8 @@ const MoveConvMessage = ({
convAction({
operation: `move`,
ids: selectedIDs,
parent: id
parent: id,
constrains: CONV_ACTION_CONSTRAINS
})
)
.then((res) => {
Expand Down
5 changes: 3 additions & 2 deletions src/views/sidebar/accordion-custom-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { FOLDERS } from '../../carbonio-ui-commons/constants/folders';
import { isSystemFolder } from '../../carbonio-ui-commons/helpers/folders';
import type { Folder } from '../../carbonio-ui-commons/types/folder';
import type { DragEnterAction, OnDropActionProps } from '../../carbonio-ui-commons/types/sidebar';
import { LIST_LIMIT } from '../../constants';
import { CONV_ACTION_CONSTRAINS, LIST_LIMIT } from '../../constants';
import { isDraft, isSpam } from '../../helpers/folders';
import { parseMessageSortingOptions } from '../../helpers/sorting';
import { useAppDispatch } from '../../hooks/redux';
Expand Down Expand Up @@ -147,7 +147,8 @@ const AccordionCustomComponent: FC<{ item: Folder }> = ({ item }) => {
convAction({
operation: `move`,
ids: convMsgsIds,
parent: item.id
parent: item.id,
constrains: CONV_ACTION_CONSTRAINS
})
).then((res) => {
if (res.type.includes('fulfilled')) {
Expand Down

0 comments on commit 5fe3bfd

Please sign in to comment.