Skip to content

Commit

Permalink
Regression: fix small issues before release (#27443)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre <pierre.lehnen@rocket.chat>
  • Loading branch information
ggazzo and pierre-lehnen-rc authored Dec 3, 2022
1 parent c9ebfb5 commit aabb324
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 43 deletions.
2 changes: 0 additions & 2 deletions apps/meteor/app/ui-login/client/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/meteor/app/ui-login/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './client/index';
import './username/username.ts';
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
import type { Blaze } from 'meteor/blaze';
import { escapeHTML } from '@rocket.chat/string-helpers';

import { settings } from '../../../settings/client';
import { Button } from '../../../ui/client';
import { t } from '../../../utils/client';
import { callbacks } from '../../../../lib/callbacks';
import { dispatchToastMessage } from '../../../../client/lib/toast';
import { settings } from '../../settings/client';
import { Button } from '../../ui/client';
import { t } from '../../utils/client';
import { callbacks } from '../../../lib/callbacks';
import { dispatchToastMessage } from '../../../client/lib/toast';
import './username.html';

type UsernameTemplateInstance = Blaze.TemplateInstance<Record<string, never>> & {
customFields: ReactiveVar<Record<
Expand All @@ -32,15 +32,14 @@ type UsernameTemplateInstance = Blaze.TemplateInstance<Record<string, never>> &
}>;
validate: () => unknown;
};

Template.username.onCreated(function (this: UsernameTemplateInstance) {
this.customFields = new ReactiveVar(null);
this.username = new ReactiveVar({
ready: false,
username: '',
});

Tracker.autorun(() => {
this.autorun(() => {
const accountsCustomFields = settings.get('Accounts_CustomFields');
if (typeof accountsCustomFields === 'string' && accountsCustomFields.trim() !== '') {
try {
Expand Down
69 changes: 42 additions & 27 deletions apps/meteor/app/ui-message/client/messageBox/userActionIndicator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Template } from 'meteor/templating';
import type { TranslationKey } from '@rocket.chat/ui-contexts';

import { UserAction } from '../../../ui/client';
import { t } from '../../../utils/client';
Expand All @@ -17,43 +18,57 @@ Template.userActionIndicator.helpers({

const activities = Object.entries(roomAction);
const userActions = activities
.map(([key, _users]) => {
const users = Object.keys(_users);
if (users.length === 0) {
return {
end: false,
};
}
.map(
([key, _users]):
| {
action?: TranslationKey;
users?: string;
end: false | true;
}
| undefined => {
const users = Object.keys(_users);
if (users.length === 0) {
return {
end: false,
};
}

const action = key.split('-')[1];

if (action !== 'typing' && action !== 'recording' && action !== 'uploading') {
return undefined;
}

if (users.length === 1) {
return {
action: `is_${action}`,
users: users[0],
end: false,
};
}

let last = users.pop();
if (users.length >= maxUsernames) {
last = t('others');
}

const action = key.split('-')[1];
if (users.length === 1) {
const usernames = [users.slice(0, maxUsernames - 1).join(', '), last];
return {
action: `is_${action}`,
users: users[0],
action: `are_${action}`,
users: usernames.join(` ${t('and')} `),
end: false,
};
}

let last = users.pop();
if (users.length >= maxUsernames) {
last = t('others');
}

const usernames = [users.slice(0, maxUsernames - 1).join(', '), last];
return {
action: `are_${action}`,
users: usernames.join(` ${t('and')} `),
end: false,
};
})
.filter((i) => i.action);
},
)
.filter((i) => i && 'action' in i);

if (!Object.keys(userActions).length) {
return [];
}

// insert end=true for the last item.
userActions[userActions.length - 1].end = true;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
userActions[userActions.length - 1]!.end = true;
return userActions;
},
});
2 changes: 1 addition & 1 deletion apps/meteor/client/importPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import '../app/tokenpass/client';
import '../app/ui/client';
import '../app/ui-account/client';
import '../app/ui-clean-history/client';
import '../app/ui-login/client';
import '../app/ui-login';
import '../app/ui-master/client';
import '../app/ui-message/client';
import '../app/ui-sidenav/client';
Expand Down
4 changes: 4 additions & 0 deletions apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,10 @@
"archive-room": "Archive Room",
"archive-room_description": "Permission to archive a channel",
"are_typing": "are typing",
"are_uploading": "are uploading",
"are_recording": "are recording",
"is_uploading": "is uploading",
"is_recording": "is recording",
"Are_you_sure": "Are you sure?",
"Are_you_sure_you_want_to_clear_all_unread_messages": "Are you sure you want to clear all unread messages?",
"Are_you_sure_you_want_to_close_this_chat": "Are you sure you want to close this chat?",
Expand Down
8 changes: 4 additions & 4 deletions fuselage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

if [ "${@:1:1}" != "undo" ]; then
if [[ $1 != "undo" ]]; then
echo "linking local project"
else
echo "unlinking local project"
Expand All @@ -10,19 +10,19 @@ cd ./node_modules/@rocket.chat

rm -rf fuselage

if [ "${@:1:1}" != "undo" ]; then
if [[ $1 != "undo" ]]; then
ln -s ../../../fuselage/packages/fuselage fuselage
fi

cd ../..
cd ./apps/meteor/node_modules/@rocket.chat
rm -rf fuselage
if [ "${@:1:1}" != "undo" ]; then
if [[ $1 != "undo" ]]; then
echo "linking local project"
ln -s ../../../../../fuselage/packages/fuselage fuselage
fi

cd ../../../../
if [ "${@:1:1}" == "undo" ]; then
if [[ $1 == "undo" ]]; then
yarn
fi
6 changes: 6 additions & 0 deletions packages/web-ui-registration/src/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ export const LoginForm = ({ setLoginRoute }: { setLoginRoute: DispatchLoginRoute
<TextInput
{...register('username', {
required: true,
onChange: () => {
clearErrors(['username', 'password']);
},
})}
placeholder={t('registration.component.form.emailPlaceholder')}
error={
Expand All @@ -124,6 +127,9 @@ export const LoginForm = ({ setLoginRoute }: { setLoginRoute: DispatchLoginRoute
<PasswordInput
{...register('password', {
required: true,
onChange: () => {
clearErrors(['username', 'password']);
},
})}
error={
errors.password?.message ||
Expand Down

0 comments on commit aabb324

Please sign in to comment.