Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use botJoinMessage from config with default being the same as before #282

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions config/config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// (see readme for more details)
"matrixServerUrl": "http://localhost:8008/",
"matrixServerName": "localhost",
// "botJoinMessage": "Joining room … See FAQ _" (full default in code)
// Set this to 100 since that is the max that Synapse will backfill even if you do a
// `/messages?limit=1000` and we don't want to miss messages in between.
"messageLimit": 100,
Expand Down
17 changes: 11 additions & 6 deletions server/lib/matrix-utils/ensure-room-joined.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ assert(matrixServerUrl);

const matrixViewerURLCreator = new MatrixViewerURLCreator(basePath);

const defaultJoinMessage = `Joining room to check history visibility. ` +
`If your room is public with shared or world readable history visibility, ` +
`it will be accessible on ${matrixViewerURLCreator.roomDirectoryUrl()}. ` +
`See the FAQ for more details: ` +
`https://github.com/matrix-org/matrix-viewer/blob/main/docs/faq.md#why-did-the-bot-join-my-room`;

config.defaults({
botJoinMessage: defaultJoinMessage,
});

async function ensureRoomJoined(
accessToken,
roomIdOrAlias,
Expand Down Expand Up @@ -49,12 +59,7 @@ async function ensureRoomJoined(
accessToken,
abortSignal,
body: {
reason:
`Joining room to check history visibility. ` +
`If your room is public with shared or world readable history visibility, ` +
`it will be accessible on ${matrixViewerURLCreator.roomDirectoryUrl()}. ` +
`See the FAQ for more details: ` +
`https://github.com/matrix-org/matrix-viewer/blob/main/docs/faq.md#why-did-the-bot-join-my-room`,
reason: config.get("botJoinMessage"),
},
});
assert(
Expand Down