Regression: fix outdated data on canned filters (#22766)

Co-authored-by: Kevin Aleman <kevin.aleman@rocket.chat>
pull/22763/head
Martin Schoeler 4 years ago committed by GitHub
parent f7c9bec004
commit 9ab92cb9b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ee/app/api-enterprise/server/lib/canned-responses.js
  2. 4
      ee/client/omnichannel/cannedResponses/CannedResponseFilter.tsx
  3. 10
      ee/client/omnichannel/cannedResponses/CannedResponsesRoute.tsx

@ -115,7 +115,7 @@ export async function findAllCannedResponsesFilter({ userId, shortcut, text, dep
...shortcut ? [{ shortcut }] : [],
...text ? [{ $or: [{ shortcut: textFilter }, { text: textFilter }] }] : [],
...scope ? [{ scope }] : [],
...createdBy ? [{ 'createdBy.username': createdBy }] : [],
...createdBy ? [{ 'createdBy._id': createdBy }] : [],
...tags.length ? [{
tags: {
$in: tags,

@ -7,8 +7,8 @@ import AutoCompleteTagsMultiple from '../tags/AutoCompleteTagsMultiple';
type CannedResponsesFilterProps = {
sharingValue: string;
createdByValue: { value: string; label: string };
tagsValue: string;
createdByValue: string;
tagsValue: Array<{ value: string; label: string }>;
shortcutValue: string;
setSharing: (eventOrValue: unknown) => void;
setCreatedBy: (eventOrValue: unknown) => void;

@ -25,15 +25,15 @@ const CannedResponsesRoute: FC = () => {
type CannedResponseFilterValues = {
sharing: string;
createdBy: { value: string; label: string };
tags: string;
createdBy: string;
tags: Array<{ value: string; label: string }>;
text: string;
firstMessage: string;
};
const { values, handlers } = useForm({
sharing: '',
createdBy: {},
createdBy: '',
tags: [],
text: '',
});
@ -52,9 +52,9 @@ const CannedResponsesRoute: FC = () => {
() => ({
text: debouncedText,
sort: JSON.stringify({ [debouncedSort[0]]: debouncedSort[1] === 'asc' ? 1 : -1 }),
...(tags && tags.length > 0 && { tags }),
...(tags && tags.length > 0 && { tags: tags.map((tag) => tag.label) }),
...(sharing && { scope: sharing }),
...(createdBy?.label && { createdBy: createdBy.label }),
...(createdBy && createdBy !== 'all' && { createdBy }),
...(debouncedParams.itemsPerPage && { count: debouncedParams.itemsPerPage }),
...(debouncedParams.current && { offset: debouncedParams.current }),
}),

Loading…
Cancel
Save