Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
- name: Use Node.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N.B. Remember to update the Dockerfile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in af9075b

uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- run: yarn --ignore-scripts --pure-lockfile --strict-semver
- run: yarn lint
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [16, 18]
node_version: [20]
steps:
- uses: actions/checkout@v2
- name: Use Node.js
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [16, 18]
node_version: [20]
steps:
- uses: actions/checkout@v2
- name: Use Node.js
Expand All @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we should make sure this works before merging.

strategy:
matrix:
node_version: [16, 18]
node_version: [20]
steps:
- uses: actions/checkout@v2
- name: Use Node.js
Expand Down
83 changes: 42 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.1.2",
"description": "A Matrix <--> Slack bridge",
"engines": {
"node": ">=16 <=18"
"node": ">=20"
},
"main": "app.js",
"scripts": {
Expand Down Expand Up @@ -34,63 +34,64 @@
"homepage": "https://github.com/matrix-org/matrix-appservice-slack#readme",
"dependencies": {
"@alloc/quick-lru": "^5.2.0",
"@slack/logger": "^3.0.0",
"@slack/rtm-api": "^6.0.0",
"@slack/logger": "^4.0.0",
"@slack/rtm-api": "^6.2.1",
"@slack/web-api": "^6.7.2",
"Slackdown": "git+https://[email protected]/half-shot/slackdown.git",
"ajv": "^8.12.0",
"axios": "^0.27.2",
"classnames": "^2.3.2",
"axios": "^1.6.8",
"classnames": "^2.5.1",
"escape-string-regexp": "^4.0.0",
"https-proxy-agent": "^5.0.1",
"matrix-appservice-bridge": "^8.1.2",
"matrix-widget-api": "^1.1.1",
"minimist": "^1.2.6",
"https-proxy-agent": "^7.0.4",
"matrix-appservice-bridge": "^10.1.0",
"matrix-bot-sdk": "^0.7.1",
"matrix-widget-api": "^1.6.0",
"minimist": "^1.2.8",
"nedb": "^1.8.0",
"node-emoji": "^1.10.0",
"node-emoji": "^2.1.3",
"nunjucks": "^3.2.4",
"p-queue": "^6.0.0",
"pg-promise": "^10.11.1",
"randomstring": "^1.2.1",
"pg-promise": "^11.5.5",
"randomstring": "^1.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"url-join": "^5.0.0",
"uuid": "^8.3.2",
"yargs": "17.5.1"
"uuid": "^9.0.1",
"yargs": "17.7.2"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.3",
"@tsconfig/node16": "^1.0.3",
"@types/chai": "^4.2.21",
"@types/js-yaml": "^4.0.2",
"@types/mocha": "^9.1.1",
"@types/nedb": "^1.8.12",
"@types/node": "^18.6.1",
"@types/node-emoji": "^1.8.1",
"@types/nunjucks": "^3.1.5",
"@types/randomstring": "^1.1.7",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@types/uuid": "^8.3.1",
"@types/yargs": "17.0.10",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.50.0",
"@vitejs/plugin-react": "^3.1.0",
"autoprefixer": "^10.4.13",
"@tailwindcss/forms": "^0.5.7",
"@tsconfig/node20": "^20.1.3",
"@types/chai": "^4.3.14",
"@types/js-yaml": "^4.0.9",
"@types/mocha": "^10.0.6",
"@types/nedb": "^1.8.16",
"@types/node": "^20.11.30",
"@types/node-emoji": "^2.1.0",
"@types/nunjucks": "^3.2.6",
"@types/randomstring": "^1.1.12",
"@types/react": "^18.2.71",
"@types/react-dom": "^18.2.22",
"@types/uuid": "^9.0.8",
"@types/yargs": "17.0.32",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.19",
"chai": "^4.3.4",
"eslint": "^8.20.0",
"eslint-plugin-jsdoc": "^39.3.3",
"eslint": "^8.57.0",
"eslint-plugin-jsdoc": "^48.2.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"js-yaml": "^4.1.0",
"mocha": "^10.0.0",
"postcss": "^8.4.21",
"prom-client": "^14.0.1",
"postcss": "^8.4.38",
"prom-client": "^15.1.0",
"source-map-support": "^0.5.19",
"tailwindcss": "^3.2.4",
"ts-node": "^10.1.0",
"typescript": "^4.4.3",
"vite": "^4.1.1"
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.3",
"vite": "^5.2.6"
}
}
8 changes: 4 additions & 4 deletions src/BridgedRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import axios from "axios";
import { Logger, Intent } from "matrix-appservice-bridge";
import { SlackGhost } from "./SlackGhost";
import { Main, METRIC_SENT_MESSAGES } from "./Main";
import { default as substitutions, getFallbackForMissingEmoji, IMatrixToSlackResult } from "./substitutions";
import { default as substitutions, IMatrixToSlackResult } from "./substitutions";
import * as emoji from "node-emoji";
import { ISlackMessageEvent, ISlackEvent, ISlackFile } from "./BaseSlackHandler";
import { WebAPIPlatformError, WebClient } from "@slack/web-api";
Expand Down Expand Up @@ -306,7 +306,7 @@ export class BridgedRoom {
// bot user. Search for #fix_reactions_as_bot.
const res = await client.reactions.add({
as_user: false,
channel: this.slackChannelId,
channel: this.slackChannelId!,
name: emojiKeyName,
timestamp: event.slackTs,
});
Expand Down Expand Up @@ -710,7 +710,7 @@ export class BridgedRoom {
if (ghostChanged) {
await this.main.fixDMMetadata(this, ghost);
}
this.slackSendLock = this.slackSendLock.then(() => {
this.slackSendLock = this.slackSendLock.then(async () => {
// Check again
if (this.recentSlackMessages.includes(message.ts)) {
// We sent this, ignore
Expand Down Expand Up @@ -743,7 +743,7 @@ export class BridgedRoom {
return;
}

let reactionKey = emoji.emojify(`:${message.reaction}:`, getFallbackForMissingEmoji);
let reactionKey = emoji.emojify(`:${message.reaction}:`);
// Element uses the default thumbsup and thumbsdown reactions with an appended variant character.
if (reactionKey === '👍' || reactionKey === '👎') {
reactionKey += '\ufe0f'.normalize(); // VARIATION SELECTOR-16
Expand Down
2 changes: 1 addition & 1 deletion src/SlackRTMHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export class SlackRTMHandler extends SlackEventHandler {
const intent = await room.getIntentForRoom();
// We only want to act on trivial messages
// This can be asyncronous to the handling of the message.
intent.getStateEvent(room.MatrixRoomId, 'm.room.member', puppet.matrixId, true).then((state) => {
intent.getStateEvent(room.MatrixRoomId, 'm.room.member', puppet.matrixId, true).then(async (state) => {
if (!['invite', 'join'].includes(state?.membership)) {
// Automatically invite the user the room.
log.info(`User ${puppet.matrixId} is not in ${room.MatrixRoomId}/${room.SlackChannelId}, inviting`);
Expand Down
10 changes: 1 addition & 9 deletions src/substitutions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ const log = new Logger("substitutions");
const ATTACHMENT_TYPES = ["m.audio", "m.video", "m.file", "m.image"];
const PILL_REGEX = /<a href="https:\/\/matrix\.to\/#\/(#|@|\+)([^"]+)">([^<]+)<\/a>/g;

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this is now part of the functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I've now added tests to verify this.

* Will return the emoji's name within ':'.
* @param name The emoji's name.
*/
export const getFallbackForMissingEmoji = (name: string): string => (
`:${name}:`
);

interface PillItem {
id: string;
text: string;
Expand Down Expand Up @@ -74,7 +66,7 @@ class Substitutions {
body = url ? body.replace(file.permalink, url) : body;
}

body = emoji.emojify(body, getFallbackForMissingEmoji);
body = emoji.emojify(body);

return body;
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@tsconfig/node16/tsconfig.json",
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"outDir": "./lib",
Expand Down
1 change: 0 additions & 1 deletion widget/src/ProvisioningApp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { createContext, useEffect, useMemo, useState } from 'react';
import { WidgetApi, WidgetApiToWidgetAction } from 'matrix-widget-api';
import urlJoin from 'url-join';

import { ProvisioningClient, ProvisioningError } from './ProvisioningClient';
import * as Text from './components/text';
Expand Down
Loading