Skip to content

Commit

Permalink
Merge branch 'develop' into improve/search-chats-by-source-type
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman committed Nov 18, 2022
2 parents f25b034 + 2c829b1 commit 43a1952
Show file tree
Hide file tree
Showing 221 changed files with 3,841 additions and 2,007 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,9 @@ jobs:
RC_DOCKER_TAG: '${{ needs.release-versions.outputs.gh-docker-tag }}.official'
DOCKER_TAG: ${{ needs.release-versions.outputs.gh-docker-tag }}
TRANSPORTER: nats://nats:4222
ENTERPRISE_LICENSE: ${{ secrets.ENTERPRISE_LICENSE }}
# this is 100% intentional, secrets are not available at forks, so ee-tests will always fail
# to avoid this, we are using a dummy license, expiring on 2022-12-31
ENTERPRISE_LICENSE: GWHMQe3C3lu3if4ropk1iQ09sCKjIaQogwMymgl7pbuotLpHPhTzxvuSqJYmEtHGKX4MQsrYA+8witFF3JMOc3AswwAkxQz+TZz9+XfiBo49p7OL0xfO6f9ElhLHclptcEPFDSilQlmDI1Jjr7k+MdqXxE4XbZ4Pdeg9vdEDtroKvSvd0ngtFMkIXa6829Cg0nzTCCcWo3Jc80JPub6VMgpdZ2KnsswQt8dBz+psvztcwrqF7X5731HkPX0lTttjF6SSIs+WAIdwAY4b2VRtD3PbMWxbe0ac+2x5+ItIRH0PFRh/gVWdtiKfskQpcucU739CX/d4pQGK/OWxKifH1XH824doeyYuvjXwvCW5anPlRXKAqIn2gh6LcdGfFNIbjX9wG4/U162vDr3AtEpRYdjzfvvBW1gveYMGidIiEhQZu7h5Ie9b3tNBkNBgBcqibL9JO6K3/2pxX7gymjT+9VRZgB5+ME2pziD54SjSWCwkLcf/RByxArdDSqI3llKjyDnRXjhqzsLhmsc6UdJCJd1IiqjQ4v5QXH2C57cJlej93ZLuNRFcnb0cE0nAFHIfLSZP5CSJA/gY7mtBL0b0osUisNL/os7a74JFMoa4DDfTD2CarYV5E4+fpX3NqINzpYwFzZi9pH2wIL6oe1yuZPcn9vjRhK2jvG81tHSR/4s=
run: |
docker compose -f docker-compose-ci.yml up -d --build
Expand Down
6 changes: 5 additions & 1 deletion apps/meteor/app/api/server/v1/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,12 @@ API.v1.addRoute(
return API.v1.failure('Username is already in use');
}

const { secret: secretURL, ...params } = this.bodyParams;
// Register the user
const userId = Meteor.call('registerUser', this.bodyParams);
const userId = Meteor.call('registerUser', {
...params,
...(secretURL && { secretURL }),
});

// Now set their username
Meteor.runAsUser(userId, () => Meteor.call('setUsername', this.bodyParams.username));
Expand Down
6 changes: 5 additions & 1 deletion apps/meteor/app/authentication/server/startup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ Accounts.onCreateUser(function (options, user = {}) {
to: destinations,
from: settings.get('From_Email'),
subject: Accounts.emailTemplates.userToActivate.subject(),
html: Accounts.emailTemplates.userToActivate.html(options),
html: Accounts.emailTemplates.userToActivate.html({
...options,
name: options.name || options.profile?.name,
email: options.email || user.emails[0].address,
}),
};

Mailer.send(email);
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/app/lib/server/startup/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,15 @@ settingsRegistry.addGroup('Accounts', function () {
values: [
{
key: 'default',
i18nLabel: 'Default',
i18nLabel: 'Selected_first_reply_unselected_following_replies',
},
{
key: 'always',
i18nLabel: 'Always',
i18nLabel: 'Selected_by_default',
},
{
key: 'never',
i18nLabel: 'Never',
i18nLabel: 'Unselected_by_default',
},
],
public: true,
Expand Down
14 changes: 13 additions & 1 deletion apps/meteor/app/livechat/lib/messageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,20 @@ MessageTypes.registerType({
...(comment && { comment }),
}),
queue: (): string =>
TAPi18n.__('Livechat_transfer_return_to_the_queue', {
TAPi18n.__(`Livechat_transfer_return_to_the_queue${commentLabel}`, {
from,
...(comment && { comment }),
}),
autoTransferUnansweredChatsToAgent: (): string =>
TAPi18n.__(`Livechat_transfer_to_agent_auto_transfer_unanswered_chat`, {
from,
to: message?.transferData?.transferredTo?.name || message?.transferData?.transferredTo?.username || '',
duration: comment,
}),
autoTransferUnansweredChatsToQueue: (): string =>
TAPi18n.__(`Livechat_transfer_return_to_the_queue_auto_transfer_unanswered_chat`, {
from,
duration: comment,
}),
};
return {
Expand Down
8 changes: 8 additions & 0 deletions apps/meteor/app/livechat/server/hooks/saveAnalyticsData.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { isOmnichannelRoom } from '@rocket.chat/core-typings';
import { callbacks } from '../../../../lib/callbacks';
import { LivechatRooms } from '../../../models/server';
import { normalizeMessageFileUpload } from '../../../utils/server/functions/normalizeMessageFileUpload';
import { callbackLogger } from '../lib/callbackLogger';

callbacks.add(
'afterSaveMessage',
function (message, room) {
callbackLogger.debug(`Calculating Omnichannel metrics for room ${room._id}`);
// check if room is livechat
if (!isOmnichannelRoom(room)) {
return message;
Expand All @@ -19,6 +21,10 @@ callbacks.add(

// if the message has a token, it was sent by the visitor
if (message.token) {
// When visitor sends a mesage, most metrics wont be calculated/served.
// But, v.lq (last query) will be updated to the message time. This has to be done
// As not doing it will cause the metrics to be crazy and not have real values.
LivechatRooms.saveAnalyticsDataByRoomId(room, message);
return message;
}

Expand All @@ -37,6 +43,7 @@ callbacks.add(
const isResponseTotal = room.metrics && room.metrics.response && room.metrics.response.total;

if (agentLastReply === room.ts) {
callbackLogger.debug('Calculating: first message from agent');
// first response
const firstResponseDate = now;
const firstResponseTime = (now.getTime() - visitorLastQuery) / 1000;
Expand All @@ -58,6 +65,7 @@ callbacks.add(
reactionTime,
};
} else if (visitorLastQuery > agentLastReply) {
callbackLogger.debug('Calculating: visitor sent a message after agent');
// response, not first
const responseTime = (now.getTime() - visitorLastQuery) / 1000;
const avgResponseTime =
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/livechat/server/lib/Livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ export const Livechat = {
return RoutingManager.transferRoom(room, guest, transferData);
},

returnRoomAsInquiry(rid, departmentId) {
returnRoomAsInquiry(rid, departmentId, overrideTransferData = {}) {
Livechat.logger.debug(`Transfering room ${rid} to ${departmentId ? 'department' : ''} queue`);
const room = LivechatRooms.findOneById(rid);
if (!room) {
Expand Down Expand Up @@ -791,7 +791,7 @@ export const Livechat = {

const transferredBy = normalizeTransferredByData(user, room);
Livechat.logger.debug(`Transfering room ${room._id} by user ${transferredBy._id}`);
const transferData = { roomId: rid, scope: 'queue', departmentId, transferredBy };
const transferData = { roomId: rid, scope: 'queue', departmentId, transferredBy, ...overrideTransferData };
try {
this.saveTransferHistory(room, transferData);
RoutingManager.unassignAgent(inquiry, departmentId);
Expand Down
14 changes: 13 additions & 1 deletion apps/meteor/app/mail-messages/server/functions/sendMail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ import { placeholders } from '../../../utils/server';
import { SystemLogger } from '../../../../server/lib/logger/system';
import * as Mailer from '../../../mailer';

export const sendMail = function (from: string, subject: string, body: string, dryrun: boolean, query: string): void {
export const sendMail = function ({
from,
subject,
body,
dryrun,
query,
}: {
from: string;
subject: string;
body: string;
dryrun?: boolean;
query?: string;
}): void {
Mailer.checkAddressFormatAndThrow(from, 'Mailer.sendMail');

if (body.indexOf('[unsubscribe]') === -1) {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/mail-messages/server/methods/sendMail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Meteor.methods({
});
}

return Mailer.sendMail(from, subject, body, dryrun, query);
return Mailer.sendMail({ from, subject, body, dryrun, query });
},
});

Expand Down
39 changes: 0 additions & 39 deletions apps/meteor/app/models/server/models/LivechatRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,45 +835,6 @@ export class LivechatRooms extends Base {
return this.update(query, update);
}

setAutoTransferredAtById(roomId) {
const query = {
_id: roomId,
};
const update = {
$set: {
autoTransferredAt: new Date(),
},
};

return this.update(query, update);
}

setAutoTransferOngoingById(roomId) {
const query = {
_id: roomId,
};
const update = {
$set: {
autoTransferOngoing: true,
},
};

return this.update(query, update);
}

unsetAutoTransferOngoingById(roomId) {
const query = {
_id: roomId,
};
const update = {
$unset: {
autoTransferOngoing: 1,
},
};

return this.update(query, update);
}

changeVisitorByRoomId(roomId, { _id, username, token }) {
const query = {
_id: roomId,
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/app/search/client/provider/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ Template.DefaultSearchResultTemplate.onCreated(function () {

// global search
this.globalSearchEnabled = this.data.settings.GlobalSearchEnabled;
this.data.parentPayload.searchAll = this.globalSearchEnabled;
// default value for global search
this.data.parentPayload.searchAll = false;

this.hasMore = new ReactiveVar(true);

Expand Down
10 changes: 2 additions & 8 deletions apps/meteor/app/theme/client/imports/general/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ body {
-moz-osx-font-smoothing: grayscale;
}

@media (width <= 500px) {
body {
position: fixed;
}
}

:focus {
outline: 0 !important;
outline-style: none;
Expand All @@ -54,7 +48,7 @@ body {
display: table;
clear: both;

content: "";
content: '';
}
}

Expand Down Expand Up @@ -136,7 +130,7 @@ button {
width: 100%;
height: 1px;

content: "";
content: '';

animation-name: unread;
animation-duration: 0.2s;
Expand Down
Loading

0 comments on commit 43a1952

Please sign in to comment.