Skip to content

Commit

Permalink
Merge branch 'develop' into lingohub_language_update_2022-11-21Z
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Nov 22, 2022
2 parents 4c5fc1b + 8b14fc6 commit 3198c2d
Show file tree
Hide file tree
Showing 19 changed files with 488 additions and 232 deletions.
15 changes: 15 additions & 0 deletions apps/meteor/app/apps/client/orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,21 @@ class AppClientOrchestrator {
if ('url' in result) {
return result;
}

throw new Error('Failed to build external url');
}

public async buildIncompatibleExternalUrl(appId: string, appVersion: string, action: string): Promise<IAppExternalURL> {
const result = await APIClient.get('/apps/incompatibleModal', {
appId,
appVersion,
action,
});

if ('url' in result) {
return result;
}

throw new Error('Failed to build external url');
}

Expand Down
17 changes: 17 additions & 0 deletions apps/meteor/app/apps/server/communication/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { formatAppInstanceForRest } from '../../lib/misc/formatAppInstanceForRes
import { actionButtonsHandler } from './endpoints/actionButtonsHandler';
import { fetch } from '../../../../server/lib/http/fetch';

const rocketChatVersion = Info.version;
const appsEngineVersionForMarketplace = Info.marketplaceApiVersion.replace(/-.*/g, '');
const getDefaultHeaders = () => ({
'X-Apps-Engine-Version': appsEngineVersionForMarketplace,
Expand Down Expand Up @@ -65,6 +66,22 @@ export class AppsRestApi {

this.api.addRoute('actionButtons', ...actionButtonsHandler(this));

this.api.addRoute(
'incompatibleModal',
{ authRequired: true },
{
async get() {
const baseUrl = orchestrator.getMarketplaceUrl();
const workspaceId = settings.get('Cloud_Workspace_Id');
const { action, appId, appVersion } = this.queryParams;

return API.v1.success({
url: `${baseUrl}/apps/${appId}/incompatible/${appVersion}/${action}?workspaceId=${workspaceId}&rocketChatVersion=${rocketChatVersion}`,
});
},
},
);

// WE NEED TO MOVE EACH ENDPOINT HANDLER TO IT'S OWN FILE
this.api.addRoute(
'',
Expand Down
17 changes: 16 additions & 1 deletion apps/meteor/app/models/server/models/Rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export class Rooms extends Base {
}

findOneByNonValidatedName(name, options) {
const room = this.findOneByName(name, options);
const room = this.findOneByNameOrFname(name, options);
if (room) {
return room;
}
Expand All @@ -332,6 +332,21 @@ export class Rooms extends Base {
return this.findOne(query, options);
}

findOneByNameOrFname(name, options) {
const query = {
$or: [
{
name,
},
{
fname: name,
},
],
};

return this.findOne(query, options);
}

findOneByNameAndNotId(name, rid) {
const query = {
_id: { $ne: rid },
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/lib/utils/prependReplies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ export const prependReplies = async (msg: string, replies: IMessage[] = [], ment
);

chunks.push(msg);
return chunks.join(' ');
return chunks.join('\n');
};
2 changes: 1 addition & 1 deletion apps/meteor/client/providers/UserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const UserProvider: FC = ({ children }) => {
});
}),
logout,
loginWithService: <T extends LoginService>({ service, clientConfig }: T): (() => Promise<true>) => {
loginWithService: <T extends LoginService>({ service, clientConfig = {} }: T): (() => Promise<true>) => {
const loginMethods = {
'meteor-developer': 'MeteorDeveloperAccount',
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
import type { App } from '@rocket.chat/core-typings';
import { Box } from '@rocket.chat/fuselage';
import { Box, Tag } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import moment from 'moment';
import React, { ReactElement } from 'react';

import AppAvatar from '../../../../components/avatar/AppAvatar';
import AppMenu from '../AppMenu';
import BundleChips from '../BundleChips';
import { appIncompatibleStatusProps } from '../helpers';
import AppStatus from './tabs/AppStatus';

const versioni18nKey = (app: App): string => {
const { version, marketplaceVersion, marketplace } = app;
if (typeof marketplace === 'boolean') {
return marketplaceVersion;
}

return version;
};

const AppDetailsPageHeader = ({ app }: { app: App }): ReactElement => {
const t = useTranslation();
const { iconFileData, name, author, version, iconFileContent, installed, isSubscribed, modifiedAt, bundledIn } = app;
const { iconFileData, name, author, iconFileContent, installed, modifiedAt, bundledIn, versionIncompatible, isSubscribed } = app;
const lastUpdated = modifiedAt && moment(modifiedAt).fromNow();
const incompatibleStatus = versionIncompatible ? appIncompatibleStatusProps() : undefined;

return (
<Box display='flex' flexDirection='row' mbe='x20' w='full'>
Expand All @@ -25,6 +36,7 @@ const AppDetailsPageHeader = ({ app }: { app: App }): ReactElement => {
{bundledIn && Boolean(bundledIn.length) && <BundleChips bundledIn={bundledIn} />}
</Box>
{app?.shortDescription && <Box mbe='x16'>{app.shortDescription}</Box>}

<Box display='flex' flexDirection='row' alignItems='center' mbe='x16'>
<AppStatus app={app} installed={installed} isAppDetailsPage />
{(installed || isSubscribed) && <AppMenu app={app} isAppDetailsPage mis='x8' />}
Expand All @@ -34,11 +46,26 @@ const AppDetailsPageHeader = ({ app }: { app: App }): ReactElement => {
{t('By_author', { author: author?.name })}
</Box>
<Box is='span'> | </Box>
<Box mi='x16'>{t('Version_version', { version })}</Box>

<Box mi='x16' marginInlineEnd='x4'>
{t('Version_version', { version: versioni18nKey(app) })}
</Box>

{versionIncompatible && (
<Box is='span' marginInlineEnd='x16' marginBlockStart='x4'>
<Tag
title={incompatibleStatus?.tooltipText}
variant={incompatibleStatus?.label === 'Disabled' ? 'secondary-danger' : 'secondary'}
>
{incompatibleStatus?.label}
</Tag>
</Box>
)}

{lastUpdated && (
<>
<Box is='span'> | </Box>
<Box mis='x16'>
<Box mi='x16'>
{t('Marketplace_app_last_updated', {
lastUpdated,
})}
Expand Down

This file was deleted.

Loading

0 comments on commit 3198c2d

Please sign in to comment.