Skip to content

Commit

Permalink
Regression: Support generating pdfs from queue (#28162)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman committed Feb 28, 2023
1 parent a05fb3c commit 3418e20
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
1 change: 1 addition & 0 deletions apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Expand Up @@ -3544,6 +3544,7 @@
"Not_authorized": "Not authorized",
"Normal": "Normal",
"Not_Available": "Not Available",
"Not_assigned": "Not assigned",
"Not_enough_data": "Not enough data",
"Not_following": "Not following",
"Not_Following": "Not Following",
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/tests/end-to-end/api/livechat/00-rooms.ts
Expand Up @@ -1652,14 +1652,14 @@ describe('LIVECHAT - rooms', function () {
.set(credentials)
.expect(400);
});
it('should fail if no one is serving the room', async () => {
it('should return OK if no one is serving the room (queued)', async () => {
const visitor = await createVisitor();
const { _id } = await createLivechatRoom(visitor.token);
await closeRoom(_id);
await request
.post(api(`omnichannel/${_id}/request-transcript`))
.set(credentials)
.expect(400);
.expect(200);
});
let roomId: string;
it('should request a pdf transcript when all conditions are met', async () => {
Expand Down
12 changes: 2 additions & 10 deletions ee/packages/omnichannel-services/src/OmnichannelTranscript.ts
Expand Up @@ -118,7 +118,7 @@ export class OmnichannelTranscript extends ServiceClass implements IOmnichannelT
throw new Error('room-still-open');
}

if (!room.servedBy || !room.v) {
if (!room.v) {
throw new Error('improper-room-state');
}

Expand Down Expand Up @@ -208,15 +208,7 @@ export class OmnichannelTranscript extends ServiceClass implements IOmnichannelT
}

private async getTranslations(): Promise<Array<{ key: string; value: string }>> {
const keys: string[] = [
'Agent',
'Date',
'Customer',
'Omnichannel_Agent',
'Time',
'Chat_transcript',
'This_attachment_is_not_supported',
];
const keys: string[] = ['Agent', 'Date', 'Customer', 'Not_assigned', 'Time', 'Chat_transcript', 'This_attachment_is_not_supported'];

return Promise.all(
keys.map(async (key) => {
Expand Down
Expand Up @@ -43,7 +43,7 @@ const styles = StyleSheet.create({
});

export const ChatTranscriptPDF = ({ header, messages, t }: ChatTranscriptData) => {
const agentValue = header.agent?.name || header.agent?.username || t('Omnichannel_Agent');
const agentValue = header.agent?.name || header.agent?.username || t('Not_assigned');
const customerValue = header.visitor?.name || header.visitor?.username;
const dateValue = header.date;
const timeValue = header.time;
Expand Down

0 comments on commit 3418e20

Please sign in to comment.