Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into release-v0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Jan 20, 2020
2 parents ed2a825 + a859735 commit 67941ee
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 120 deletions.
53 changes: 0 additions & 53 deletions .buildkite/pipeline.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .dockerignore

This file was deleted.

6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ WORKDIR /build

RUN apt-get update && apt-get install -y git python3 libicu-dev build-essential

COPY . /build/
COPY src/ /build/src/
COPY types/ /build/types/
COPY .eslintrc *json /build/

RUN npm ci
RUN npm run build
Expand All @@ -34,7 +36,7 @@ COPY --from=freebind /freebindfree/libfreebindfree.so /app/libfreebindfree.so
COPY --from=builder /build/node_modules /app/node_modules
COPY --from=builder /build/lib /app/lib

COPY app.js /app/
COPY app.js config.schema.yml /app/
COPY docker /app/docker

ENV LD_PRELOAD /app/libfreebindfree.so
Expand Down
1 change: 1 addition & 0 deletions changelog.d/919.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
If a new DM room is created for a IRC user, discard the old room.
1 change: 1 addition & 0 deletions changelog.d/920.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix missig config.schema.yml in the Docker image
1 change: 1 addition & 0 deletions changelog.d/921.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stop trying to use sentry when config.sentry.enabled is false
1 change: 1 addition & 0 deletions changelog.d/925.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve reply matching logic for Matrix messages.
1 change: 1 addition & 0 deletions changelog.d/931.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use Typescript 3.7 and fix build issues.
121 changes: 90 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@
"@sentry/node": "^5.9.0"
},
"devDependencies": {
"@types/bluebird": "^3.5.27",
"@types/express": "^4.17.2",
"@types/extend": "^3.0.1",
"@types/bluebird": "^3.5.27",
"@types/he": "^1.1.0",
"@types/nedb": "^1.8.9",
"@types/nopt": "^3.0.29",
"@types/pg": "^7.11.1",
"@types/sanitize-html": "^1.20.2",
"@typescript-eslint/eslint-plugin": "^2.2.0",
"@typescript-eslint/parser": "^2.2.0",
"@typescript-eslint/eslint-plugin": "^2.14.0",
"@typescript-eslint/parser": "^2.14.0",
"eslint": "^5.16.0",
"jasmine": "^3.1.0",
"nyc": "^14.1.1",
"prom-client": "^11.5.3",
"proxyquire": "^1.4.0",
"typescript": "^3.6.3",
"prom-client": "^11.5.3"
"typescript": "^3.7.3"
}
}
4 changes: 2 additions & 2 deletions src/bridge/AdminRoomHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class AdminRoomHandler {
});
for (const r of matrixRooms) {
const userMustJoin = (
key || server.shouldSyncMembershipToIrc("incremental", r.getId())
key ?? server.shouldSyncMembershipToIrc("incremental", r.getId())
);
if (!userMustJoin) {
continue;
Expand All @@ -283,7 +283,7 @@ export class AdminRoomHandler {
for (let i = 0; i < matrixRooms.length; i++) {
const m = matrixRooms[i];
const userMustJoin = (
key || server.shouldSyncMembershipToIrc("incremental", m.getId())
key ?? server.shouldSyncMembershipToIrc("incremental", m.getId())
);
if (userMustJoin) {
// force join then break out (we only ever join once no matter how many
Expand Down
2 changes: 1 addition & 1 deletion src/bridge/IrcBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class IrcBridge {
});
}
// Dependency graph
this.matrixHandler = new MatrixHandler(this, this.config.matrixHandler);
this.matrixHandler = new MatrixHandler(this, this.config.matrixHandler || {});
if (!this.config.database && this.config.ircService.databaseUri) {
log.warn("ircService.databaseUri is a deprecated config option." +
"Please use the database configuration block");
Expand Down
6 changes: 2 additions & 4 deletions src/bridge/MatrixHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ export class MatrixHandler {
// maintain a list of room IDs which are being processed invite-wise. This is
// required because invites are processed asyncly, so you could get invite->msg
// and the message is processed before the room is created.
config = config || {}
this.eventCacheMaxSize = config.eventCacheSize === undefined ?
DEFAULT_EVENT_CACHE_SIZE : config.eventCacheSize;
this.eventCacheMaxSize = config.eventCacheSize ?? DEFAULT_EVENT_CACHE_SIZE;
// The media URL to use to transform mxc:// URLs when handling m.room.[file|image]s
this.mediaUrl = ircBridge.config.homeserver.media_url || ircBridge.config.homeserver.url;
this.adminHandler = new AdminRoomHandler(ircBridge, this);
Expand Down Expand Up @@ -1097,7 +1095,7 @@ export class MatrixHandler {

private async textForReplyEvent(event: MatrixMessageEvent, replyEventId: string, ircRoom: IrcRoom):
Promise<{formatted: string; reply: string}|null> {
const REPLY_REGEX = /> <(.*)>(.*)\n\n(.*)/;
const REPLY_REGEX = /> <(.*?)>(.*?)\n\n(.*)/;
const REPLY_NAME_MAX_LENGTH = 12;
const eventId = replyEventId;
if (!event.content.body) {
Expand Down
9 changes: 8 additions & 1 deletion src/datastore/postgres/PgDataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,14 @@ export class PgDataStore implements DataStore {
}

public async setPmRoom(ircRoom: IrcRoom, matrixRoom: MatrixRoom, userId: string, virtualUserId: string): Promise<void> {
await this.pgPool.query("INSERT INTO pm_rooms VALUES ($1, $2, $3, $4, $5)", [
await this.pgPool.query(
PgDataStore.BuildUpsertStatement("pm_rooms", "ON CONSTRAINT cons_pm_rooms_matrix_irc_unique", [
"room_id",
"irc_domain",
"irc_nick",
"matrix_user_id",
"virtual_user_id",
]), [
matrixRoom.getId(),
ircRoom.getDomain(),
ircRoom.getChannel(),
Expand Down
2 changes: 1 addition & 1 deletion src/irc/ClientPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export class ClientPool {
return undefined;
}
const cli = this.virtualClients[server.domain].nicks[nick];
if (!cli || cli.isDead()) {
if (cli?.isDead()) {
return undefined;
}
return cli;
Expand Down
2 changes: 1 addition & 1 deletion src/irc/ConnectionInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class ConnectionInstance {

return new Bluebird((resolve) => {
// close the connection
this.client.disconnect(ircReason, () => {});
this.client.disconnect(ircReason, () => { /* This is needed for tests */ });
// remove timers
if (this.pingRateTimerId) {
clearTimeout(this.pingRateTimerId);
Expand Down
Loading

0 comments on commit 67941ee

Please sign in to comment.