Skip to content

Commit

Permalink
Merge branch 'develop' into chore/apps-engine-package
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert authored Sep 11, 2024
2 parents 8d5e504 + 18b1b99 commit 863149b
Show file tree
Hide file tree
Showing 241 changed files with 584 additions and 101 deletions.
6 changes: 6 additions & 0 deletions .changeset/short-drinks-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/message-parser': patch
'@rocket.chat/peggy-loader': patch
---

Improved the performance of the message parser
5 changes: 5 additions & 0 deletions .changeset/wet-hats-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed issue that caused an infinite loading state when uploading a private app to Rocket.Chat
41 changes: 41 additions & 0 deletions .github/workflows/ci-deploy-gh-pages-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# .github/workflows/ci-preview.yml
name: Deploy PR previews
concurrency: preview-${{ github.ref }}
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: rharkor/[email protected]
if: github.event.action != 'closed'

- name: Setup NodeJS
uses: ./.github/actions/setup-node
if: github.event.action != 'closed'
with:
node-version: 14.21.3
cache-modules: true
install: true

- name: Build
if: github.event.action != 'closed'
run: |
yarn turbo run build-preview
yarn turbo run .:build-preview-move
npx indexifier .preview --html --extensions .html > .preview/index.html
- uses: rossjrw/pr-preview-action@v1
with:
source-dir: .preview
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
38 changes: 38 additions & 0 deletions .github/workflows/ci-deploy-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# .github/workflows/ci-preview-deploy.yml
name: Deploy GitHub Pages
concurrency: preview-deploy-${{ github.ref }}
on:
push:
branches:
- main
- master
- develop
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: rharkor/[email protected]

- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: 14.21.3
cache-modules: true
install: true

- name: Build
run: |
yarn turbo run build-preview
yarn turbo run .:build-preview-move
npx indexifier .preview --html --extensions .html > .preview/index.html
mv .preview ${{ github.ref_name }}
mkdir .preview
mv ${{ github.ref_name }} .preview
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .preview
keep_files: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ yarn-error.log*
.history
.envrc

.preview

*.sublime-workspace

**/.vim/
Expand Down
1 change: 1 addition & 0 deletions _templates/package/new/package.json.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ to: packages/<%= name %>/package.json
"test": "jest",
"build": "rm -rf dist && tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch --preserveWatchOutput"
"build-preview": "mkdir -p ../../.preview && cp -r ./dist ../../.preview/<%= name.toLowerCase() %>"
},
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/views/admin/users/AdminUserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ const AdminUserForm = ({ userData, onReload, context, refetchUserFormData, roleD
/>
</FieldRow>
{errors?.email && (
<FieldError aria-live='assertive' id={`${emailId}-error`} fontScale='c1' mbs={12}>
<FieldError aria-live='assertive' id={`${emailId}-error`}>
{errors.email.message}
</FieldError>
)}
Expand Down
8 changes: 6 additions & 2 deletions apps/meteor/client/views/marketplace/hooks/useInstallApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ export const useInstallApp = (file: File, url: string): { install: () => void; i
};

const extractManifestFromAppFile = async (appFile: File) => {
const manifest = await getManifestFromZippedApp(appFile);
return manifest;
try {
return getManifestFromZippedApp(appFile);
} catch (error) {
handleInstallError(error as Error);
}
};

const install = async () => {
Expand Down Expand Up @@ -158,6 +161,7 @@ export const useInstallApp = (file: File, url: string): { install: () => void; i
handleEnableUnlimitedApps={() => {
openExternalLink(manageSubscriptionUrl);
setModal(null);
setInstalling(false);
}}
/>,
);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build-preview": "tsc && vite build",
".:build-preview-move": "mkdir -p ../../.preview/ && cp -r ./dist ../../.preview/uikit-playground",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig(() => ({
logLevel: 'info',
base: './',
esbuild: {},
plugins: [react()],
optimizeDeps: {
Expand Down
8 changes: 4 additions & 4 deletions packages/fuselage-ui-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
"@rocket.chat/icons": "*",
"@rocket.chat/prettier-config": "*",
"@rocket.chat/styled": "*",
"@rocket.chat/ui-avatar": "6.0.0",
"@rocket.chat/ui-contexts": "10.0.0",
"@rocket.chat/ui-kit": "0.36.1",
"@rocket.chat/ui-video-conf": "10.0.0",
"@rocket.chat/ui-avatar": "*",
"@rocket.chat/ui-contexts": "*",
"@rocket.chat/ui-kit": "*",
"@rocket.chat/ui-video-conf": "*",
"@tanstack/react-query": "*",
"react": "*",
"react-dom": "*"
Expand Down
4 changes: 2 additions & 2 deletions packages/gazzodown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
"@rocket.chat/fuselage-tokens": "*",
"@rocket.chat/message-parser": "0.31.29",
"@rocket.chat/styled": "*",
"@rocket.chat/ui-client": "10.0.0",
"@rocket.chat/ui-contexts": "10.0.0",
"@rocket.chat/ui-client": "*",
"@rocket.chat/ui-contexts": "*",
"katex": "*",
"react": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1800,7 +1800,7 @@
"Markdown_SupportSchemesForLink_Description": "Comma-separated list of allowed schemes",
"E2E_enable": "Enable E2E",
"E2E_disable": "Disable E2E",
"E2E_Enable_alert": "This feature is currently in beta! Please report bugs to github.com/RocketChat/Rocket.Chat/issues and be aware of:<br/>- Encrypted messages of encrypted rooms will not be found by search operations.<br/>- The mobile apps may not support the encrypted messages (they are implementing it).<br/>- Bots may not be able to see encrypted messages until they implement support for it.<br/>- Uploads will not be encrypted in this version.",
"E2E_Enable_alert": "This feature is currently in beta! Please report bugs to github.com/RocketChat/Rocket.Chat/issues and be aware of:<br/>- Encrypted messages of encrypted rooms will not be found by search operations.<br/>- Bots may not be able to see encrypted messages until they implement support for it.",
"E2E_Enable_description": "Enable option to create encrypted groups and be able to change groups and direct messages to be encrypted",
"E2E_Enabled": "E2E Enabled",
"E2E_Enabled_Default_DirectRooms": "Enable encryption for Direct Rooms by default",
Expand Down
126 changes: 71 additions & 55 deletions packages/message-parser/src/grammar.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
emoji,
emojiUnicode,
emoticon,
extractFirstResult,
heading,
image,
inlineCode,
Expand All @@ -33,6 +34,11 @@
unorderedList,
timestamp,
} = require('./utils');

let skipBold = false;
let skipItalic = false;
let skipStrikethrough = false;
let skipReferences = false;
}}

Start
Expand Down Expand Up @@ -212,7 +218,7 @@ Inline = value:(InlineItem / Any)+ EndOfLine? { return reducePlainTexts(value);

InlineItem = Whitespace
/ Timestamp
/ References
/ MaybeReferences
/ AutolinkedPhone
/ AutolinkedEmail
/ AutolinkedURL
Expand Down Expand Up @@ -240,7 +246,7 @@ References
= "[" title:LinkTitle* "](" href:LinkRef ")" { return title.length ? link(href, reducePlainTexts(title)) : link(href); }
/ "<" href:LinkRef "|" title:LinkTitle2 ">" { return link(href, [plain(title)]); }

LinkTitle = (Whitespace / EmphasisForReferences) / anyTitle:$(!("](" .) .) { return plain(anyTitle) }
LinkTitle = (Whitespace / Emphasis) / anyTitle:$(!("](" .) .) { return plain(anyTitle) }

LinkTitle2 = $([\x20-\x3B\x3D\x3F-\x60\x61-\x7B\x7D-\xFF] / NonASCII)+

Expand Down Expand Up @@ -349,14 +355,7 @@ AutoLinkURLBody = !(Extra* (Whitespace / EndOfLine)) .
* Emphasis
*
*/
Emphasis = Bold / Italic / Strikethrough
/**
*
* Emphasis for References
*
*/
EmphasisForReferences = BoldForReferences / ItalicForReferences / StrikethroughForReferences
Emphasis = MaybeBold / MaybeItalic / MaybeStrikethrough
/**
*
Expand All @@ -365,6 +364,63 @@ EmphasisForReferences = BoldForReferences / ItalicForReferences / StrikethroughF
*
*/
// This rule is used inside expressions that have a JS code ensuring they always fail,
// Without any pattern to match, peggy will think the rule may end up succedding without consuming any input, which could cause infinite loops
// So this unreachable rule is added to them to satisfy peggy's requirement.
BlockedByJavascript = 'unreachable'

MaybeBold
= result:(
& {
if (skipBold) { return false; }
skipBold = true;
return true;
}
(
(text:Bold { skipBold = false; return text; })
/ (& { skipBold = false; return false; } BlockedByJavascript)
)
) { return extractFirstResult(result); }

MaybeStrikethrough
= result:(
& {
if (skipStrikethrough) { return false; }
skipStrikethrough = true;
return true;
}
(
(text:Strikethrough { skipStrikethrough = false; return text; })
/ (& { skipStrikethrough = false; return false; } BlockedByJavascript)
)
) { return extractFirstResult(result); }

MaybeItalic
= result:(
& {
if (skipItalic) { return false; }
skipItalic = true;
return true;
}
(
(text:Italic { skipItalic = false; return text; })
/ (& { skipItalic = false; return false; } BlockedByJavascript)
)
) { return extractFirstResult(result); }

MaybeReferences
= result:(
& {
if (skipReferences) { return false; }
skipReferences = true;
return true;
}
(
(text:References { skipReferences = false; return text; })
/ (& { skipReferences = false; return false; } BlockedByJavascript)
)
) { return extractFirstResult(result); }

/* Italic */
Italic
= value:$([a-zA-Z0-9]+ [\x5F] [\x5F]?) { return plain(value); }
Expand All @@ -384,11 +440,11 @@ ItalicContentItems = text:ItalicContentItem+ { return reducePlainTexts(text); }
ItalicContentItem
= Whitespace
/ InlineCode
/ References
/ MaybeReferences
/ UserMention
/ ChannelMention
/ Bold
/ Strikethrough
/ MaybeBold
/ MaybeStrikethrough
/ Emoji
/ Emoticon
/ AnyItalic
Expand All @@ -399,52 +455,12 @@ Bold = [\x2A] [\x2A] @BoldContent [\x2A] [\x2A] / [\x2A] @BoldContent [\x2A]

BoldContent = text:BoldContentItem+ { return bold(reducePlainTexts(text)); }

BoldContentItem = Whitespace / InlineCode / References / UserMention / ChannelMention / Italic / Strikethrough / Emoji / Emoticon / AnyBold / Line
BoldContentItem = Whitespace / InlineCode / MaybeReferences / UserMention / ChannelMention / MaybeItalic / MaybeStrikethrough / Emoji / Emoticon / AnyBold / Line

/* Strike */
Strikethrough = [\x7E] [\x7E] @StrikethroughContent [\x7E] [\x7E] / [\x7E] @StrikethroughContent [\x7E]

StrikethroughContent = text:(Timestamp / InlineCode / Whitespace / References / UserMention / ChannelMention / Italic / Bold / Emoji / Emoticon / AnyStrike / Line)+ {
return strike(reducePlainTexts(text));
}
/* Italic for References */
ItalicForReferences
= value:$([a-zA-Z0-9]+ [\x5F] [\x5F]?) { return plain(value); }
/ [\x5F] [\x5F] i:ItalicContentItemsForReferences [\x5F] [\x5F] t:$[a-zA-Z0-9]+ {
return reducePlainTexts([plain('__'), ...i, plain('__'), plain(t)])[0];
}
/ [\x5F] i:ItalicContentItemsForReferences [\x5F] t:$[a-zA-Z]+ {
return reducePlainTexts([plain('_'), ...i, plain('_'), plain(t)])[0];
}
/ [\x5F] [\x5F] @ItalicContentForReferences [\x5F] [\x5F]
/ [\x5F] @ItalicContentForReferences [\x5F]
ItalicContentForReferences = text:ItalicContentItemsForReferences { return italic(text); }
ItalicContentItemsForReferences = text:ItalicContentItemForReferences+ { return reducePlainTexts(text); }
ItalicContentItemForReferences
= Whitespace
/ UserMention
/ ChannelMention
/ BoldForReferences
/ StrikethroughForReferences
/ Emoji
/ Emoticon
/ AnyItalic
/ Line
/ InlineCode
/* Bold for References */
BoldForReferences = [\x2A] [\x2A] @BoldContentForReferences [\x2A] [\x2A] / [\x2A] @BoldContentForReferences [\x2A]
BoldContentForReferences = text:(Whitespace / UserMention / ChannelMention / ItalicForReferences / StrikethroughForReferences / Emoji / Emoticon / AnyBold / Line / InlineCode)+ { return bold(reducePlainTexts(text)); }
/* Strike for References */
StrikethroughForReferences = [\x7E] [\x7E] @StrikethroughContentForReferences [\x7E] [\x7E] / [\x7E] @StrikethroughContentForReferences [\x7E]
StrikethroughContentForReferences = text:(Whitespace / UserMention / ChannelMention / ItalicForReferences / BoldForReferences / Emoji / Emoticon / AnyStrike / Line / InlineCode)+ {
StrikethroughContent = text:(Timestamp / Whitespace / InlineCode / MaybeReferences / UserMention / ChannelMention / MaybeItalic / MaybeBold / Emoji / Emoticon / AnyStrike / Line)+ {
return strike(reducePlainTexts(text));
}

Expand Down
Loading

0 comments on commit 863149b

Please sign in to comment.