Skip to content

Commit

Permalink
Merge branch 'develop' into chore/remove-method-call
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Aug 12, 2022
2 parents 5df00d0 + 9557513 commit ceb9a7b
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 8 deletions.
14 changes: 14 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@
/apps/meteor/client/ @RocketChat/frontend
/apps/meteor/tests/ @RocketChat/chat-engine
/apps/meteor/app/apps/ @RocketChat/apps
/apps/meteor/app/livechat @RocketChat/omnichannel
/apps/meteor/app/voip @RocketChat/omnichannel
/apps/meteor/app/sms @RocketChat/omnichannel
/apps/meteor/packages/rocketchat-livechat @RocketChat/omnichannel
/apps/meteor/packages/rocketchat-i18n @RocketChat/translation
/apps/meteor/server/services/voip @RocketChat/omnichannel
/apps/meteor/server/services/omnichannel-voip @RocketChat/omnichannel
/apps/meteor/server/features/EmailInbox @RocketChat/omnichannel
/apps/meteor/ee/app/canned-responses @RocketChat/omnichannel
/apps/meteor/ee/app/livechat @RocketChat/omnichannel
/apps/meteor/ee/app/livechat-enterprise @RocketChat/omnichannel
/apps/meteor/ee/client/omnichannel @RocketChat/omnichannel
/apps/meteor/client/components/omnichannel @RocketChat/omnichannel
/apps/meteor/client/components/voip @RocketChat/omnichannel
4 changes: 2 additions & 2 deletions apps/meteor/app/livechat/imports/server/rest/sms.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const defineDepartment = (idOrName) => {
};

const defineVisitor = async (smsNumber, targetDepartment) => {
const visitor = LivechatVisitors.findOneVisitorByPhone(smsNumber);
const visitor = await LivechatVisitors.findOneVisitorByPhone(smsNumber);
let data = {
token: (visitor && visitor.token) || Random.id(),
};
Expand Down Expand Up @@ -86,7 +86,7 @@ API.v1.addRoute('livechat/sms-incoming/:service', {

const visitor = await defineVisitor(sms.from, targetDepartment);
const { token } = visitor;
const room = LivechatRooms.findOneOpenByVisitorTokenAndDepartmentId(token, targetDepartment);
const room = LivechatRooms.findOneOpenByVisitorTokenAndDepartmentIdAndSource(token, targetDepartment, OmnichannelSourceType.SMS);
const roomExists = !!room;
const location = normalizeLocationSharing(sms);
const rid = (room && room._id) || Random.id();
Expand Down
5 changes: 4 additions & 1 deletion apps/meteor/app/models/server/models/LivechatRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,16 @@ export class LivechatRooms extends Base {
return this.findOne(query, options);
}

findOneOpenByVisitorTokenAndDepartmentId(visitorToken, departmentId, options) {
findOneOpenByVisitorTokenAndDepartmentIdAndSource(visitorToken, departmentId, source, options) {
const query = {
't': 'l',
'open': true,
'v.token': visitorToken,
departmentId,
};
if (source) {
query['source.type'] = source;
}

return this.findOne(query, options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ function UserAvatarEditor({ currentUsername, username, setAvatarObj, suggestions
<Avatar url={`/avatar/%40${username}`} />
</Button>
<IconButton icon='upload' secondary onClick={clickUpload} disabled={disabled} title={t('Upload')} />
<IconButton icon='permalink' secondary onClick={clickUrl} disabled={disabled || urlEmpty} title={t('Add URL')} />
<IconButton
data-qa-id='UserAvatarEditorSetAvatarLink'
icon='permalink'
secondary
onClick={clickUrl}
disabled={disabled || urlEmpty}
title={t('Add URL')}
/>
{suggestions && (
<UserAvatarSuggestions
suggestions={suggestions}
Expand All @@ -89,7 +96,13 @@ function UserAvatarEditor({ currentUsername, username, setAvatarObj, suggestions
</Box>
<Margins inlineStart='x4'>
<Box>{t('Use_url_for_avatar')}</Box>
<TextInput flexGrow={0} placeholder={t('Use_url_for_avatar')} value={avatarFromUrl} onChange={handleAvatarFromUrlChange} />
<TextInput
data-qa-id='UserAvatarEditorLink'
flexGrow={0}
placeholder={t('Use_url_for_avatar')}
value={avatarFromUrl}
onChange={handleAvatarFromUrlChange}
/>
</Margins>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Box, Icon, States, StatesIcon, StatesTitle } from '@rocket.chat/fuselag
import { useTranslation } from '@rocket.chat/ui-contexts';
import React, { ReactElement, ComponentProps } from 'react';

import { timeAgo } from '../../../../../app/ui/client/views/app/helpers';
import {
GenericTable,
GenericTableBody,
Expand All @@ -13,6 +12,7 @@ import {
GenericTableLoadingRow,
GenericTableRow,
} from '../../../../components/GenericTable';
import { timeAgo } from '../../../../lib/utils/timeAgo';
import type { WebdavSortOptions } from './WebdavFilePickerModal';
import { getNodeFileSize } from './lib/getNodeFileSize';
import { getNodeIconType } from './lib/getNodeIconType';
Expand Down Expand Up @@ -83,7 +83,7 @@ const WebdavFilePickerTable = ({
<Box withTruncatedText>{getNodeFileSize(webdavNode.type, webdavNode?.size)}</Box>
</GenericTableCell>
<GenericTableCell fontScale='p2' color='default'>
<Box withTruncatedText>{timeAgo(new Date(), t)}</Box>
<Box withTruncatedText>{timeAgo(new Date())}</Box>
</GenericTableCell>
</GenericTableRow>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/ko.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"__count__empty_rooms_will_be_removed_automatically": "__count__ 빈 대화방은 자동으로 제거됩니다.",
"__count__empty_rooms_will_be_removed_automatically__rooms__": "__count__ 빈 대화방은 자동으로 제거됩니다 : <br/> __rooms__.",
"__username__is_no_longer__role__defined_by__user_by_": "__user_by__님이 __username__님을 __role__ 역할에서 제외시켰습니다.",
"__username__was_set__role__by__user_by_": "__user_by__님이 __username__님에 의해 __role__에 지정됨",
"__username__was_set__role__by__user_by_": "__username__님이 __user_by__님에 의해 __role__에 지정됨",
"This_room_encryption_has_been_enabled_by__username_": "__username__님이 방 암호화를 활성화함",
"This_room_encryption_has_been_disabled_by__username_": "__username__님이 방 암호화를 비활성화함",
"@username": "@사용자명",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions apps/meteor/tests/e2e/page-objects/account-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export class AccountProfile {
return this.page.locator('//label[contains(text(), "Name")]/..//input');
}

get inputAvatarLink(): Locator {
return this.page.locator('[data-qa-id="UserAvatarEditorLink"]');
}

get btnSetAvatarLink(): Locator {
return this.page.locator('[data-qa-id="UserAvatarEditorSetAvatarLink"]');
}

get inputUsername(): Locator {
return this.page.locator('//label[contains(text(), "Username")]/..//input');
}
Expand Down Expand Up @@ -63,4 +71,8 @@ export class AccountProfile {
get btnRemoveTokenModal(): Locator {
return this.page.locator('//button[contains(text(), "Remove")]');
}

get inputImageFile(): Locator {
return this.page.locator('input[type=file]');
}
}
21 changes: 21 additions & 0 deletions apps/meteor/tests/e2e/settings-account-profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,25 @@ test.describe.serial('settings-account-profile', () => {
await expect(page.locator('.rcx-toastbar.rcx-toastbar--success')).toBeVisible();
});
});

test.describe('Change avatar', () => {
test.beforeEach(async () => {
await poHomeChannel.sidenav.goToMyAccount();
});

test('expect change avatar image by upload', async ({ page }) => {
await poAccountProfile.inputImageFile.setInputFiles('./tests/e2e/fixtures/files/test-image.jpeg');

await poAccountProfile.btnSubmit.click();
await expect(page.locator('.rcx-toastbar.rcx-toastbar--success').first()).toBeVisible();
});

test('expect set image from url', async ({ page }) => {
await poAccountProfile.inputAvatarLink.fill('https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50');
await poAccountProfile.btnSetAvatarLink.click();

await poAccountProfile.btnSubmit.click();
await expect(page.locator('.rcx-toastbar.rcx-toastbar--success').first()).toBeVisible();
});
});
});

0 comments on commit ceb9a7b

Please sign in to comment.