Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Persistent Chat Discussion Name wildcard #33920

Merged
merged 9 commits into from
Nov 18, 2024
6 changes: 6 additions & 0 deletions .changeset/silent-steaks-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": minor
"@rocket.chat/i18n": minor
---

Improves the customizability of the naming of automatic Persistent video calls discussions, allowing the date of the call to be in different parts of the name, using the `[date]` keyword.
3 changes: 2 additions & 1 deletion apps/meteor/ee/server/settings/video-conference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ export function addSettings(): Promise<void> {

const persistentChatEnabled = { _id: 'VideoConf_Enable_Persistent_Chat', value: true };

await this.add('VideoConf_Persistent_Chat_Discussion_Name', 'Conference Call Chat History', {
await this.add('VideoConf_Persistent_Chat_Discussion_Name', 'Video Call Chat', {
type: 'string',
public: true,
invalidValue: 'Conference Call Chat History',
i18nDescription: 'VideoConf_Persistent_Chat_Discussion_Name_Description',
enableQuery: [discussionsEnabled, persistentChatEnabled],
});
},
Expand Down
11 changes: 9 additions & 2 deletions apps/meteor/server/services/video-conference/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1097,8 +1097,15 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf
return;
}

const name = settings.get<string>('VideoConf_Persistent_Chat_Discussion_Name') || i18n.t('Conference Call Chat History');
const displayName = `${name} - ${new Date().toISOString().substring(0, 10)}`;
const name = settings.get<string>('VideoConf_Persistent_Chat_Discussion_Name') || i18n.t('[date] Video Call Chat');
MartinSchoeler marked this conversation as resolved.
Show resolved Hide resolved
let displayName;
const date = new Date().toISOString().substring(0, 10);

if (name.includes('[date]')) {
KevLehman marked this conversation as resolved.
Show resolved Hide resolved
displayName = name.replace('[date]', date);
} else {
displayName = `${date} ${name}`;
}

await this.createDiscussionForConference(displayName, call, createdBy);
}
Expand Down
46 changes: 44 additions & 2 deletions apps/meteor/tests/end-to-end/apps/video-conferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('Apps - Video Conferences', () => {
}

await updateSetting('VideoConf_Enable_Persistent_Chat', false);
await updateSetting('VideoConf_Persistent_Chat_Discussion_Name', 'Conference Call Chat History');
await updateSetting('VideoConf_Persistent_Chat_Discussion_Name', '[date] - Video Call Persisted Chat');
});

describe('[/video-conference.capabilities]', () => {
Expand Down Expand Up @@ -577,7 +577,49 @@ describe('Apps - Video Conferences', () => {
expect(res.body.room)
.to.have.a.property('fname')
.that.is.a('string')
.that.satisfies((msg: string) => msg.startsWith('Chat History'));
.that.satisfies((msg: string) => !msg.startsWith('Chat History'))
.that.satisfies((msg: string) => msg.includes('Chat History'));
MartinSchoeler marked this conversation as resolved.
Show resolved Hide resolved
});
});
});

describe('[Persistent Chat provider with the persistent chat feature enabled and custom discussion names]', () => {
let discussionRid: string | undefined;
let chatDate: string;

before(async () => {
if (!process.env.IS_EE) {
return;
}

await updateSetting('VideoConf_Default_Provider', 'persistentchat');
await updateSetting('Discussion_enabled', true);
await updateSetting('VideoConf_Enable_Persistent_Chat', true);
await updateSetting('VideoConf_Persistent_Chat_Discussion_Name', 'Date [date] between');
chatDate = new Date().toISOString().substring(0, 10);
});

it('should have created the discussion room using the configured name', async function () {
if (!process.env.IS_EE) {
this.skip();
return;
}

await request
.get(api('rooms.info'))
.set(credentials)
.query({
roomId: discussionRid,
})
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('room').and.to.be.an('object');
expect(res.body.room).to.have.a.property('_id').equal(discussionRid);
expect(res.body.room)
.to.have.a.property('fname')
.that.is.a('string')
.that.satisfies((msg: string) => msg.includes(`Date ${chatDate} between`));
});
});
});
Expand Down
1 change: 1 addition & 0 deletions packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5879,6 +5879,7 @@
"VideoConf_Enable_Persistent_Chat_description": "When persistent chat is enabled, Rocket.Chat will create a discussion every time a conference call is initiated. The provider app is responsible for sending the chat messages to this discussion.",
"VideoConf_Enable_Persistent_Chat_Alert": "Persistent Chat will not work if discussions are disabled on the workspace. It will also not work if the provider app being used do not explicitly support this feature.",
"VideoConf_Persistent_Chat_Discussion_Name": "Persistent Chat Discussion Name",
"VideoConf_Persistent_Chat_Discussion_Name_Description": "Use [date] tag to set where to include the date. Date will be added to the start if tag is not included.",
"VideoConf_Mobile_Ringing": "Enable mobile ringing",
"VideoConf_Mobile_Ringing_Description": "When enabled, direct calls to mobile users will ring their device as a phone call.",
"VideoConf_Mobile_Ringing_Alert": "This feature is currently in an experimental stage and may not yet be fully supported by the mobile app. When enabled it will send additional Push Notifications to users.",
Expand Down
Loading