Skip to content

Commit

Permalink
Merge branch 'fix/sidebar-var' of github.com:RocketChat/Rocket.Chat i…
Browse files Browse the repository at this point in the history
…nto fix/sidebar-var
  • Loading branch information
juliajforesti committed May 5, 2023
2 parents 0e7cf94 + 5b776d4 commit 6897dee
Show file tree
Hide file tree
Showing 346 changed files with 11,211 additions and 10,305 deletions.
72 changes: 38 additions & 34 deletions apps/meteor/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

rocketchat:ddp
rocketchat:mongo-config
rocketchat:oauth2-server
rocketchat:restivus
rocketchat:livechat
rocketchat:streamer
rocketchat:version
rocketchat:user-presence

[email protected]
[email protected]
Expand All @@ -17,57 +23,55 @@ [email protected]
[email protected]
[email protected]
[email protected]
blaze-html-templates

pauli:accounts-linkedin
[email protected]
[email protected]
[email protected]

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

[email protected]
[email protected]
[email protected]
[email protected]

[email protected]
[email protected]
[email protected]
[email protected]

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

rocketchat:livechat
rocketchat:streamer
rocketchat:version

rocketchat:user-presence

dispatch:run-as-user

kadira:flow-router
mrt:reactive-store
mystor:device-detection
rocketchat:restivus
ostrio:cookies
pauli:accounts-linkedin

rocketchat:[email protected]
littledata:synced-cron
kadira:flow-router

[email protected]
[email protected]
[email protected]
meteorhacks:inject-initial
[email protected]
[email protected]

[email protected]
templating
[email protected]

[email protected]
rocketchat:oauth2-server
rocketchat:i18n
[email protected]

[email protected]
[email protected]
[email protected]
mrt:reactive-store

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

[email protected]

# photoswipe

jquery
25 changes: 0 additions & 25 deletions apps/meteor/.meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@ [email protected]
[email protected]
[email protected]
[email protected]
aldeed:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Expand Down Expand Up @@ -46,27 +41,20 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
kadira:[email protected]
[email protected]
littledata:[email protected]
[email protected]
[email protected]
mdg:[email protected]
[email protected]
[email protected]
[email protected]
meteorhacks:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Expand All @@ -75,18 +63,15 @@ [email protected]
[email protected]
[email protected]
mrt:[email protected]
mystor:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
ostrio:[email protected]
pauli:[email protected]
pauli:[email protected]
[email protected]
raix:[email protected]
[email protected]
[email protected]
[email protected]
Expand All @@ -95,34 +80,24 @@ [email protected]
[email protected]
[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
rocketchat:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
simple:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/client/TOTPPassword.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';

import { t } from '../../utils/client';
import { t } from '../../utils/lib/i18n';
import { process2faReturn } from '../../../client/lib/2fa/process2faReturn';
import { isTotpInvalidError, reportError } from '../../../client/lib/2fa/utils';
import { dispatchToastMessage } from '../../../client/lib/toast';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/client/overrideMeteorCall.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';

import { t } from '../../utils/client';
import { t } from '../../utils/lib/i18n';
import { process2faReturn, process2faAsyncReturn } from '../../../client/lib/2fa/process2faReturn';
import { isTotpInvalidError } from '../../../client/lib/2fa/utils';
import { dispatchToastMessage } from '../../../client/lib/toast';
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/2fa/server/code/EmailCheck.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Random } from '@rocket.chat/random';
import { TAPi18n } from 'meteor/rocketchat:tap-i18n';
import { Accounts } from 'meteor/accounts-base';
import bcrypt from 'bcrypt';
import type { IUser } from '@rocket.chat/core-typings';
Expand All @@ -8,6 +7,7 @@ import { Users } from '@rocket.chat/models';
import { settings } from '../../../settings/server';
import * as Mailer from '../../../mailer/server/api';
import type { ICodeCheck, IProcessInvalidCodeResult } from './ICodeCheck';
import { i18n } from '../../../../server/lib/i18n';

export class EmailCheck implements ICodeCheck {
public readonly name = 'email';
Expand All @@ -34,7 +34,7 @@ export class EmailCheck implements ICodeCheck {
private async send2FAEmail(address: string, random: string, user: IUser): Promise<void> {
const language = user.language || settings.get('Language') || 'en';

const t = (s: string): string => TAPi18n.__(s, { lng: language });
const t = (s: string): string => i18n.t(s, { lng: language });

await Mailer.send({
to: address,
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/2fa/server/functions/resetTOTP.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Meteor } from 'meteor/meteor';
import { TAPi18n } from 'meteor/rocketchat:tap-i18n';
import type { IUser } from '@rocket.chat/core-typings';
import { Users } from '@rocket.chat/models';

import { settings } from '../../../settings/server';
import * as Mailer from '../../../mailer/server/api';
import { isUserIdFederated } from '../../../../server/lib/isUserIdFederated';
import { i18n } from '../../../../server/lib/i18n';

const sendResetNotification = async function (uid: string): Promise<void> {
const user = await Users.findOneById<Pick<IUser, 'language' | 'emails'>>(uid, {
Expand All @@ -21,7 +21,7 @@ const sendResetNotification = async function (uid: string): Promise<void> {
return;
}

const t = (s: string): string => TAPi18n.__(s, { lng: language });
const t = (s: string): string => i18n.t(s, { lng: language });
const text = `
${t('Your_TOTP_has_been_reset')}
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/analytics/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import './loadScript';
import './trackEvents';
101 changes: 51 additions & 50 deletions apps/meteor/app/analytics/client/loadScript.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { useEffect } from 'react';

import { settings } from '../../settings/client';
import { useReactiveValue } from '../../../client/hooks/useReactiveValue';

declare global {
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand All @@ -18,63 +19,63 @@ declare global {
};
}

Template.body.onRendered(function () {
this.autorun(() => {
const uid = Meteor.userId();
export const useAnalytics = (): void => {
const uid = useReactiveValue(() => Meteor.userId());

const googleId = useReactiveValue(() => settings.get('GoogleAnalytics_enabled') && settings.get('GoogleAnalytics_ID'));
const piwikUrl = useReactiveValue(() => settings.get('PiwikAnalytics_enabled') && settings.get('PiwikAnalytics_url'));

useEffect(() => {
if (uid) {
window._paq = window._paq || [];
window._paq.push(['setUserId', uid]);
}
});

this.autorun((c) => {
const googleId = settings.get('GoogleAnalytics_enabled') && settings.get('GoogleAnalytics_ID');
if (googleId) {
c.stop();

if (googleId) {
/*eslint-disable */
if (googleId.startsWith("G-")) {
// Google Analytics 4
const f = document.getElementsByTagName('script')[0];
const j = document.createElement('script');
j.async = true;
j.src = `//www.googletagmanager.com/gtag/js?id=${googleId}`;
f.parentNode?.insertBefore(j, f);

// injecting the dataLayer into the windows global object
const w: Window & { dataLayer?: any } = window;
let dataLayer = w.dataLayer || [];
function gtag(key: string, value: any) { dataLayer.push(key, value); }
gtag('js', new Date());
gtag('config', googleId);
} else {
// Google Analytics 3
(function (i, s, o, g, r: 'ga', a?: any, m?: any) {
i['GoogleAnalyticsObject'] = r;
(i[r] =
i[r] ||
function () {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = new Date().getTime());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
useEffect(() => {
if (!googleId) {
return;
}
/*eslint-disable */
if (googleId.startsWith('G-')) {
// Google Analytics 4
const f = document.getElementsByTagName('script')[0];
const j = document.createElement('script');
j.async = true;
j.src = `//www.googletagmanager.com/gtag/js?id=${googleId}`;
f.parentNode?.insertBefore(j, f);

window.ga('create', googleId, 'auto');
window.ga('send', 'pageview');
}
/* eslint-enable */
// injecting the dataLayer into the windows global object
const w: Window & { dataLayer?: any } = window;
let dataLayer = w.dataLayer || [];
function gtag(key: string, value: any) {
dataLayer.push(key, value);
}
}
});
gtag('js', new Date());
gtag('config', googleId);
} else {
// Google Analytics 3
(function (i, s, o, g, r: 'ga', a?: any, m?: any) {
i['GoogleAnalyticsObject'] = r;
(i[r] =
i[r] ||
function () {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = new Date().getTime());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

this.autorun(() => {
const piwikUrl = settings.get('PiwikAnalytics_enabled') && settings.get('PiwikAnalytics_url');
window.ga('create', googleId, 'auto');
window.ga('send', 'pageview');
}
/* eslint-enable */
}, [googleId, uid]);

useEffect(() => {
if (!piwikUrl) {
document.getElementById('piwik-analytics')?.remove();
window._paq = [];
Expand Down Expand Up @@ -135,5 +136,5 @@ Template.body.onRendered(function () {
g.src = `${piwikUrl}js/`;
s.parentNode?.insertBefore(g, s);
})();
});
});
}, [piwikUrl]);
};
Loading

0 comments on commit 6897dee

Please sign in to comment.