Skip to content

Commit

Permalink
Merge branch 'develop' into chore/fix-wrong-app-metric
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert authored Dec 19, 2024
2 parents e3309f0 + 2d41274 commit 140de45
Show file tree
Hide file tree
Showing 134 changed files with 1,496 additions and 875 deletions.
6 changes: 6 additions & 0 deletions .changeset/big-timers-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/rest-typings': minor
'@rocket.chat/meteor': minor
---

Adds a new `contacts.checkExistence` endpoint, which allows identifying whether there's already a registered contact using a given email, phone, id or visitor to source association.
5 changes: 5 additions & 0 deletions .changeset/lucky-wolves-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes a UI issue that showed the incorrect migration number on the `Information` page. This was caused by a function calculating the stats before the server had migrated the database and updated the control.
5 changes: 5 additions & 0 deletions .changeset/quiet-lions-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes sidepanel list not sorting by last message inside thread
7 changes: 7 additions & 0 deletions .changeset/shaggy-bulldogs-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@rocket.chat/ui-composer': minor
'@rocket.chat/i18n': minor
'@rocket.chat/meteor': minor
---

Introduces a new option when exporting messages, allowing users to select and download a JSON file directly from client
5 changes: 5 additions & 0 deletions .changeset/slow-readers-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes an issue where the update banner wasn't showing the new version number
6 changes: 6 additions & 0 deletions .changeset/violet-pets-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/ui-client': patch
'@rocket.chat/meteor': patch
---

Fixed the data structure of the features preview
4 changes: 2 additions & 2 deletions apps/meteor/app/lib/server/methods/createChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const createChannelMethod = async (
name: string,
members: string[],
readOnly = false,
customFields: Record<string, any> = {},
customFields?: Record<string, any>,
extraData: Record<string, any> = {},
excludeSelf = false,
) => {
Expand Down Expand Up @@ -53,7 +53,7 @@ export const createChannelMethod = async (
}

return createRoom('c', name, user, members, excludeSelf, readOnly, {
customFields,
...(customFields && Object.keys(customFields).length && { customFields }),
...extraData,
});
};
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/lib/server/methods/createPrivateGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const createPrivateGroupMethod = async (
name: string,
members: string[],
readOnly = false,
customFields: Record<string, any> = {},
customFields?: Record<string, any>,
extraData: Record<string, any> = {},
excludeSelf = false,
): Promise<
Expand All @@ -51,7 +51,7 @@ export const createPrivateGroupMethod = async (
}

return createRoom('p', name, user, members, excludeSelf, readOnly, {
customFields,
...(customFields && Object.keys(customFields).length && { customFields }),
...extraData,
});
};
Expand Down
15 changes: 15 additions & 0 deletions apps/meteor/app/livechat/server/api/v1/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
isGETOmnichannelContactHistoryProps,
isGETOmnichannelContactsChannelsProps,
isGETOmnichannelContactsSearchProps,
isGETOmnichannelContactsCheckExistenceProps,
} from '@rocket.chat/rest-typings';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import { Match, check } from 'meteor/check';
Expand Down Expand Up @@ -166,6 +167,20 @@ API.v1.addRoute(
},
);

API.v1.addRoute(
'omnichannel/contacts.checkExistence',
{ authRequired: true, permissionsRequired: ['view-livechat-contact'], validateParams: isGETOmnichannelContactsCheckExistenceProps },
{
async get() {
const { contactId, visitor, email, phone } = this.queryParams;

const contact = await (visitor ? getContactByChannel(visitor) : LivechatContacts.countByContactInfo({ contactId, email, phone }));

return API.v1.success({ exists: !!contact });
},
},
);

API.v1.addRoute(
'omnichannel/contacts.history',
{ authRequired: true, permissionsRequired: ['view-livechat-contact-history'], validateParams: isGETOmnichannelContactHistoryProps },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class CachedChatSubscription extends CachedCollection<SubscriptionWithRoom, ISub
};
}

async upsertSubscription(record: ISubscription): Promise<void> {
return this.handleRecordEvent('changed', record);
}

protected deserializeFromCache(record: unknown) {
const deserialized = super.deserializeFromCache(record);

Expand Down
41 changes: 0 additions & 41 deletions apps/meteor/app/theme/client/imports/general/base_old.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,47 +181,6 @@ blockquote {
animation: highlight 6s infinite;
}

.page-settings {
& .settings-file-preview {
display: flex;
align-items: center;

& input[type='file'] {
position: absolute !important;
z-index: 10000;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
opacity: 0;

& * {
cursor: pointer;
}
}

& .preview {
overflow: hidden;
width: 100px;
height: 40px;
margin-right: 0.75rem;
border-width: var(--input-border-width);
border-color: var(--input-border-color);
border-radius: var(--input-border-radius);
background-repeat: no-repeat;
background-position: center center;
background-size: contain;

&.no-file {
display: flex;
align-items: center;
justify-content: center;
}
}
}
}

.room-not-found {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const formattingButtons: ReadonlyArray<FormattingButton> = [
command: 'i',
},
{
label: 'Strike',
label: 'Strikethrough',
icon: 'strike',
pattern: '~{{text}}~',
},
Expand All @@ -54,7 +54,7 @@ export const formattingButtons: ReadonlyArray<FormattingButton> = [
pattern: '`{{text}}`',
},
{
label: 'Multi_line',
label: 'Multi_line_code',
icon: 'multiline',
pattern: '```\n{{text}}\n``` ',
},
Expand Down
5 changes: 2 additions & 3 deletions apps/meteor/app/ui-utils/client/lib/LegacyRoomManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { roomCoordinator } from '../../../../client/lib/rooms/roomCoordinator';
import { fireGlobalEvent } from '../../../../client/lib/utils/fireGlobalEvent';
import { getConfig } from '../../../../client/lib/utils/getConfig';
import { callbacks } from '../../../../lib/callbacks';
import { CachedChatRoom, Messages, Subscriptions, CachedChatSubscription } from '../../../models/client';
import { Messages, Subscriptions, CachedChatSubscription } from '../../../models/client';
import { sdk } from '../../../utils/client/lib/SDKClient';

const maxRoomsOpen = parseInt(getConfig('maxRoomsOpen') ?? '5') || 5;
Expand Down Expand Up @@ -79,8 +79,7 @@ function getOpenedRoomByRid(rid: IRoom['_id']) {
}

const computation = Tracker.autorun(() => {
const ready = CachedChatRoom.ready.get() && mainReady.get();
if (ready !== true) {
if (!mainReady.get()) {
return;
}
Tracker.nonreactive(() =>
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/ui/client/lib/ChatMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ChatMessages implements ChatAPI {

public composer: ComposerAPI | undefined;

public setComposerAPI = (composer: ComposerAPI): void => {
public setComposerAPI = (composer?: ComposerAPI): void => {
this.composer?.release();
this.composer = composer;
};
Expand Down
38 changes: 20 additions & 18 deletions apps/meteor/app/ui/client/lib/KonchatNotification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { router } from '../../../../client/providers/RouterProvider';
import { stripTags } from '../../../../lib/utils/stringUtils';
import { CustomSounds } from '../../../custom-sounds/client/lib/CustomSounds';
import { e2e } from '../../../e2e/client';
import { Subscriptions } from '../../../models/client';
import { Subscriptions, Users } from '../../../models/client';
import { getUserPreference } from '../../../utils/client';
import { getUserAvatarURL } from '../../../utils/client/getUserAvatarURL';
import { getUserNotificationsSoundVolume } from '../../../utils/client/getUserNotificationsSoundVolume';
Expand Down Expand Up @@ -207,27 +207,29 @@ class KonchatNotification {
}
}

public newRoom(rid: IRoom['_id']) {
public newRoom() {
Tracker.nonreactive(() => {
let newRoomSound = Session.get('newRoomSound') as IRoom['_id'][] | undefined;
if (newRoomSound) {
newRoomSound = [...newRoomSound, rid];
} else {
newRoomSound = [rid];
const uid = Meteor.userId();
if (!uid) {
return;
}
const user = Users.findOne(uid, {
fields: {
'settings.preferences.newRoomNotification': 1,
'settings.preferences.notificationsSoundVolume': 1,
},
});
const newRoomNotification = getUserPreference<string>(user, 'newRoomNotification');
const audioVolume = getUserNotificationsSoundVolume(user?._id);

return Session.set('newRoomSound', newRoomSound);
});
}

public removeRoomNotification(rid: IRoom['_id']) {
let newRoomSound = (Session.get('newRoomSound') as IRoom['_id'][] | undefined) ?? [];
newRoomSound = newRoomSound.filter((_rid) => _rid !== rid);
Tracker.nonreactive(() => Session.set('newRoomSound', newRoomSound));

const link = document.querySelector(`.link-room-${rid}`);
if (!newRoomNotification) {
return;
}

link?.classList.remove('new-room-highlight');
void CustomSounds.play(newRoomNotification, {
volume: Number((audioVolume / 100).toPrecision(2)),
});
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const RoomMessage = ({
ref={messageRef}
id={message._id}
role='listitem'
aria-roledescription={sequential ? t('sequential_message') : t('message')}
aria-roledescription={t('message')}
tabIndex={0}
aria-labelledby={`${message._id}-displayName ${message._id}-time ${message._id}-content ${message._id}-read-status`}
onClick={selecting ? toggleSelected : undefined}
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/hooks/useNotifyUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const useNotifyUser = () => {
}

if ((!router.getRouteParameters().name || router.getRouteParameters().name !== sub.name) && !sub.ls && sub.alert === true) {
KonchatNotification.newRoom(sub.rid);
KonchatNotification.newRoom();
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useUserSoundPreferences } from './useUserSoundPreferences';
import { CustomSounds } from '../../app/custom-sounds/client/lib/CustomSounds';

const query = { t: 'l', ls: { $exists: false }, open: true };
export const useContinuousSoundNotification = () => {
export const useOmnichannelContinuousSoundNotification = <T>(queue: T[]) => {
const userSubscriptions = useUserSubscriptions(query);

const playNewRoomSoundContinuously = useSetting('Livechat_continuous_sound_notification_new_livechat_room');
Expand All @@ -16,6 +16,8 @@ export const useContinuousSoundNotification = () => {

const continuousCustomSoundId = newRoomNotification && `${newRoomNotification}-continuous`;

const hasUnreadRoom = userSubscriptions.length > 0 || queue.length > 0;

useEffect(() => {
let audio: ICustomSound;
if (playNewRoomSoundContinuously && continuousCustomSoundId) {
Expand All @@ -39,7 +41,7 @@ export const useContinuousSoundNotification = () => {
return;
}

if (userSubscriptions.length === 0) {
if (!hasUnreadRoom) {
CustomSounds.pause(continuousCustomSoundId);
return;
}
Expand All @@ -48,5 +50,5 @@ export const useContinuousSoundNotification = () => {
volume: notificationsSoundVolume,
loop: true,
});
}, [continuousCustomSoundId, playNewRoomSoundContinuously, userSubscriptions, notificationsSoundVolume]);
}, [continuousCustomSoundId, playNewRoomSoundContinuously, userSubscriptions, notificationsSoundVolume, hasUnreadRoom]);
};
Loading

0 comments on commit 140de45

Please sign in to comment.