Regression: Fix voip call wrap-up model not working (#26024)

<!-- This is a pull request template, you do not need to uncomment or remove the comments, they won't show up in the PR text. -->

<!-- Your Pull Request name should start with one of the following tags
  [NEW] For new features
  [IMPROVE] For an improvement (performance or little improvements) in existing features
  [FIX] For bug fixes that affect the end-user
  [BREAK] For pull requests including breaking changes
  Chore: For small tasks
  Doc: For documentation
-->

<!-- Checklist!!! If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code. 
  - I have read the Contributing Guide - https://github.com/RocketChat/Rocket.Chat/blob/develop/.github/CONTRIBUTING.md#contributing-to-rocketchat doc
  - I have signed the CLA - https://cla-assistant.io/RocketChat/Rocket.Chat
  - Lint and unit tests pass locally with my changes
  - I have added tests that prove my fix is effective or that my feature works (if applicable)
  - I have added necessary documentation (if applicable)
  - Any dependent changes have been merged and published in downstream modules
-->

## Proposed changes (including videos or screenshots)
<!-- CHANGELOG -->
<!--
  Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
  If it fixes a bug or resolves a feature request, be sure to link to that issue below.
  This description will appear in the release notes if we accept the contribution.
-->

<!-- END CHANGELOG -->

## Issue(s)
<!-- Link the issues being closed by or related to this PR. For example, you can use #594 if this PR closes issue number 594 -->
![image](https://user-images.githubusercontent.com/34130764/175973169-aa3c3f3f-8b74-43ef-87ab-53c27b9f01c9.png)

## Steps to test or reproduce
<!-- Mention how you would reproduce the bug if not mentioned on the issue page already. Also mention which screens are going to have the changes if applicable -->

## Further comments
<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
pull/25960/head
Murtaza Patrawala 4 years ago committed by GitHub
parent ba0979cf55
commit ace6f5bade
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      apps/meteor/ee/app/livechat-enterprise/server/api/lib/tags.ts
  2. 2
      apps/meteor/ee/app/livechat-enterprise/server/api/tags.js
  3. 4
      apps/meteor/ee/server/models/raw/LivechatTag.ts
  4. 2
      apps/meteor/server/services/omnichannel-voip/service.ts
  5. 4
      packages/model-typings/src/models/ILivechatTagModel.ts

@ -1,9 +1,34 @@
import { escapeRegExp } from '@rocket.chat/string-helpers';
import LivechatTag from '@rocket.chat/models';
import { LivechatTag } from '@rocket.chat/models';
import { ILivechatTag } from '@rocket.chat/core-typings';
import { hasPermissionAsync } from '../../../../../../app/authorization/server/functions/hasPermission';
export async function findTags({ userId, text, pagination: { offset, count, sort } }) {
type FindTagsParams = {
userId: string;
text: string;
pagination: {
offset: number;
count: number;
sort: object;
};
};
type FindTagsResult = {
tags: ILivechatTag[];
count: number;
offset: number;
total: number;
};
type FindTagsByIdParams = {
userId: string;
tagId: string;
};
type FindTagsByIdResult = ILivechatTag | null;
export async function findTags({ userId, text, pagination: { offset, count, sort } }: FindTagsParams): Promise<FindTagsResult> {
if (!(await hasPermissionAsync(userId, 'manage-livechat-tags')) && !(await hasPermissionAsync(userId, 'view-l-room'))) {
throw new Error('error-not-authorized');
}
@ -28,7 +53,7 @@ export async function findTags({ userId, text, pagination: { offset, count, sort
};
}
export async function findTagById({ userId, tagId }) {
export async function findTagById({ userId, tagId }: FindTagsByIdParams): Promise<FindTagsByIdResult> {
if (!(await hasPermissionAsync(userId, 'manage-livechat-tags')) && !(await hasPermissionAsync(userId, 'view-l-room'))) {
throw new Error('error-not-authorized');
}

@ -18,7 +18,7 @@ API.v1.addRoute(
pagination: {
offset,
count,
sort,
sort: JSON.parse(sort || '{}'),
},
}),
),

@ -1,11 +1,11 @@
import type { IRocketChatRecord } from '@rocket.chat/core-typings';
import { ILivechatTag } from '@rocket.chat/core-typings';
import type { ILivechatTagModel } from '@rocket.chat/model-typings';
import { getCollectionName } from '@rocket.chat/models';
import { Db } from 'mongodb';
import { BaseRaw } from '../../../../server/models/raw/BaseRaw';
export class LivechatTagRaw extends BaseRaw<IRocketChatRecord> implements ILivechatTagModel {
export class LivechatTagRaw extends BaseRaw<ILivechatTag> implements ILivechatTagModel {
constructor(db: Db) {
super(db, getCollectionName('livechat_tag'));
}

@ -284,7 +284,7 @@ export class OmnichannelVoipService extends ServiceClassInternal implements IOmn
this.logger.debug(`Room ${room._id} closed and timers set`);
this.logger.debug(`Room ${room._id} was closed at ${closeInfo.closedAt} (duration ${closeInfo.callDuration})`);
VoipRoom.closeByRoomId(room._id, closeInfo);
await VoipRoom.closeByRoomId(room._id, closeInfo);
return true;
}

@ -1,8 +1,8 @@
import type { IRocketChatRecord } from '@rocket.chat/core-typings';
import type { ILivechatTag } from '@rocket.chat/core-typings';
import type { IBaseModel } from './IBaseModel';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ILivechatTagModel extends IBaseModel<IRocketChatRecord> {
export interface ILivechatTagModel extends IBaseModel<ILivechatTag> {
//
}

Loading…
Cancel
Save