Skip to content

Commit

Permalink
Merge pull request RocketChat#31329 from RocketChat/release-6.5.2
Browse files Browse the repository at this point in the history
Release 6.5.2
  • Loading branch information
sampaiodiego authored Jan 3, 2024
2 parents e12727e + 886d920 commit 998c63d
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .changeset/bump-patch-1703700471583.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Bump @rocket.chat/meteor version.
5 changes: 5 additions & 0 deletions .changeset/three-moles-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed conversations in queue being limited to 50 items
5 changes: 5 additions & 0 deletions .changeset/tiny-glasses-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fix wrong value used for Workspace Registration
39 changes: 39 additions & 0 deletions .github/workflows/pr-update-description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 'Release PR Description'

on:
pull_request:
branches:
- master

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
update-pr:
runs-on: ubuntu-latest
if: startsWith(github.head_ref, 'release-')
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.CI_PAT }}

- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: 14.21.3
cache-modules: true
install: true

- uses: dtinth/setup-github-actions-caching-for-turbo@v1

- name: Build packages
run: yarn build

- name: Update PR description
uses: ./packages/release-action
with:
action: update-pr-description
env:
GITHUB_TOKEN: ${{ secrets.CI_PAT }}

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function buildWorkspaceRegistrationData<T extends string | undefine
const language = settings.get<string>('Language');
const organizationType = settings.get<string>('Organization_Type');
const industry = settings.get<string>('Industry');
const orgSize = settings.get<string>('Organization_Size');
const orgSize = settings.get<string>('Size');
const workspaceType = settings.get<string>('Server_Type');

const seats = await Users.getActiveLocalUserCount();
Expand Down
16 changes: 11 additions & 5 deletions apps/meteor/app/livechat/client/lib/stream/queueManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ILivechatDepartment, ILivechatInquiryRecord, IOmnichannelAgent } f

import { queryClient } from '../../../../../client/lib/queryClient';
import { callWithErrorHandling } from '../../../../../client/lib/utils/callWithErrorHandling';
import { settings } from '../../../../settings/client';
import { sdk } from '../../../../utils/client/lib/SDKClient';
import { LivechatInquiry } from '../../collections/LivechatInquiry';

Expand Down Expand Up @@ -39,7 +40,8 @@ const removeInquiry = async (inquiry: ILivechatInquiryRecord) => {
};

const getInquiriesFromAPI = async () => {
const { inquiries } = await sdk.rest.get('/v1/livechat/inquiries.queuedForUser', {});
const count = settings.get('Livechat_guest_pool_max_number_incoming_livechats_displayed') ?? 0;
const { inquiries } = await sdk.rest.get('/v1/livechat/inquiries.queuedForUser', { count });
return inquiries;
};

Expand Down Expand Up @@ -96,24 +98,28 @@ const subscribe = async (userId: IOmnichannelAgent['_id']) => {
// Register to all depts + public queue always to match the inquiry list returned by backend
const cleanDepartmentListeners = addListenerForeachDepartment(agentDepartments);
const globalCleanup = addGlobalListener();
const inquiriesFromAPI = (await getInquiriesFromAPI()) as unknown as ILivechatInquiryRecord[];

await updateInquiries(inquiriesFromAPI);
const computation = Tracker.autorun(async () => {
const inquiriesFromAPI = (await getInquiriesFromAPI()) as unknown as ILivechatInquiryRecord[];

await updateInquiries(inquiriesFromAPI);
});

return () => {
LivechatInquiry.remove({});
removeGlobalListener();
cleanDepartmentListeners?.();
globalCleanup?.();
departments.clear();
computation.stop();
};
};

export const initializeLivechatInquiryStream = (() => {
let cleanUp: (() => void) | undefined;

return async (...args: any[]) => {
return async (...args: Parameters<typeof subscribe>) => {
cleanUp?.();
cleanUp = await subscribe(...(args as [IOmnichannelAgent['_id']]));
cleanUp = await subscribe(...args);
};
})();
9 changes: 3 additions & 6 deletions apps/meteor/client/providers/OmnichannelProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const OmnichannelProvider: FC = ({ children }) => {
const omniChannelEnabled = useSetting('Livechat_enabled') as boolean;
const omnichannelRouting = useSetting('Livechat_Routing_Method');
const showOmnichannelQueueLink = useSetting('Livechat_show_queue_list_link') as boolean;
const omnichannelPoolMaxIncoming = useSetting('Livechat_guest_pool_max_number_incoming_livechats_displayed') as number;
const omnichannelPoolMaxIncoming = useSetting<number>('Livechat_guest_pool_max_number_incoming_livechats_displayed') ?? 0;
const omnichannelSortingMechanism = useSetting('Omnichannel_sorting_mechanism') as OmnichannelSortingMechanismSettingType;

const loggerRef = useRef(new ClientLogger('OmnichannelProvider'));
Expand Down Expand Up @@ -130,16 +130,13 @@ const OmnichannelProvider: FC = ({ children }) => {
}

return LivechatInquiry.find(
{
status: 'queued',
$or: [{ defaultAgent: { $exists: false } }, { 'defaultAgent.agentId': user?._id }],
},
{ status: 'queued' },
{
sort: getOmniChatSortQuery(omnichannelSortingMechanism),
limit: omnichannelPoolMaxIncoming,
},
).fetch();
}, [manuallySelected, omnichannelPoolMaxIncoming, omnichannelSortingMechanism, user?._id]),
}, [manuallySelected, omnichannelPoolMaxIncoming, omnichannelSortingMechanism]),
);

queue?.map(({ rid }) => {
Expand Down
3 changes: 3 additions & 0 deletions packages/release-action/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { bumpNextVersion } from './bumpNextVersion';
import { setupGitUser } from './gitUtils';
import { publishRelease } from './publishRelease';
import { startPatchRelease } from './startPatchRelease';
import { updatePRDescription } from './updatePRDescription';

// const getOptionalInput = (name: string) => core.getInput(name) || undefined;

Expand Down Expand Up @@ -45,6 +46,8 @@ import { startPatchRelease } from './startPatchRelease';
await bumpNextVersion({ githubToken, mainPackagePath });
} else if (action === 'patch') {
await startPatchRelease({ baseRef, githubToken, mainPackagePath });
} else if (action === 'update-pr-description') {
await updatePRDescription({ githubToken, mainPackagePath });
}
})().catch((err) => {
core.error(err);
Expand Down
75 changes: 75 additions & 0 deletions packages/release-action/src/updatePRDescription.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import fs from 'fs';
import path from 'path';

import * as core from '@actions/core';
import { exec } from '@actions/exec';
import * as github from '@actions/github';

import { setupOctokit } from './setupOctokit';
import { getChangelogEntry, getEngineVersionsMd, readPackageJson } from './utils';

export async function updatePRDescription({
githubToken,
mainPackagePath,
cwd = process.cwd(),
}: {
githubToken: string;
mainPackagePath: string;
cwd?: string;
}) {
const octokit = setupOctokit(githubToken);

// generate change logs from changesets
await exec('yarn', ['changeset', 'version']);

// get version from main package
const { version: newVersion } = await readPackageJson(mainPackagePath);

const mainPackageChangelog = path.join(mainPackagePath, 'CHANGELOG.md');

const changelogContents = fs.readFileSync(mainPackageChangelog, 'utf8');
const changelogEntry = getChangelogEntry(changelogContents, newVersion);
if (!changelogEntry) {
// we can find a changelog but not the entry for this version
// if this is true, something has probably gone wrong
throw new Error('Could not find changelog entry for version newVersion');
}

const releaseBody = (await getEngineVersionsMd(cwd)) + changelogEntry.content;

core.info('get PR description');
const result = await octokit.rest.pulls.get({
pull_number: github.context.issue.number,
body: releaseBody,
...github.context.repo,
});

const { body: originalBody = '' } = result.data;

const cleanBody = originalBody?.replace(/<!-- release-notes-start -->.*<!-- release-notes-end -->/s, '').trim() || '';

const bodyUpdated = `${cleanBody}
<!-- release-notes-start -->
<!-- This content is automatically generated. Changing this will not reflect on the final release log -->
_You can see below a preview of the release change log:_
# ${newVersion}
${releaseBody}
<!-- release-notes-end -->`;

if (bodyUpdated === originalBody) {
core.info('no changes to PR description');
return;
}

core.info('update PR description');
await octokit.rest.pulls.update({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
pull_number: github.context.issue.number,
body: bodyUpdated,
});
}
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8217,9 +8217,9 @@ __metadata:
"@rocket.chat/icons": "*"
"@rocket.chat/prettier-config": "*"
"@rocket.chat/styled": "*"
"@rocket.chat/ui-contexts": 3.0.0
"@rocket.chat/ui-contexts": 3.0.1
"@rocket.chat/ui-kit": "*"
"@rocket.chat/ui-video-conf": 3.0.0
"@rocket.chat/ui-video-conf": 3.0.1
"@tanstack/react-query": "*"
react: "*"
react-dom: "*"
Expand Down Expand Up @@ -8301,14 +8301,14 @@ __metadata:
ts-jest: ~29.0.5
typescript: ~5.2.2
peerDependencies:
"@rocket.chat/core-typings": 6.5.0
"@rocket.chat/core-typings": 6.5.1
"@rocket.chat/css-in-js": "*"
"@rocket.chat/fuselage": "*"
"@rocket.chat/fuselage-tokens": "*"
"@rocket.chat/message-parser": "*"
"@rocket.chat/styled": "*"
"@rocket.chat/ui-client": 3.0.0
"@rocket.chat/ui-contexts": 3.0.0
"@rocket.chat/ui-client": 3.0.1
"@rocket.chat/ui-contexts": 3.0.1
katex: "*"
react: "*"
languageName: unknown
Expand Down Expand Up @@ -9469,7 +9469,7 @@ __metadata:
"@rocket.chat/fuselage": "*"
"@rocket.chat/fuselage-hooks": "*"
"@rocket.chat/icons": "*"
"@rocket.chat/ui-contexts": 3.0.0
"@rocket.chat/ui-contexts": 3.0.1
react: ~17.0.2
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -9622,7 +9622,7 @@ __metadata:
"@rocket.chat/fuselage-hooks": "*"
"@rocket.chat/icons": "*"
"@rocket.chat/styled": "*"
"@rocket.chat/ui-contexts": 3.0.0
"@rocket.chat/ui-contexts": 3.0.1
react: ^17.0.2
react-dom: ^17.0.2
languageName: unknown
Expand Down Expand Up @@ -9708,7 +9708,7 @@ __metadata:
peerDependencies:
"@rocket.chat/layout": "*"
"@rocket.chat/tools": "*"
"@rocket.chat/ui-contexts": 3.0.0
"@rocket.chat/ui-contexts": 3.0.1
"@tanstack/react-query": "*"
react: "*"
react-hook-form: "*"
Expand Down

0 comments on commit 998c63d

Please sign in to comment.