Add labs option for history sharing on invite (#30313)

* Add labs option for "share history on invite"

* Set `acceptSharedHistory` when joining a room

* set `shareEncryptedHistory` when sending an invite

* Update src/i18n/strings/en_EN.json

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Richard van der Hoff
2025-07-31 15:20:37 +01:00
committed by GitHub
parent c79c8c836b
commit ab6ef2fa85
6 changed files with 72 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import { MatrixError, type MatrixClient, EventType, type EmptyObject } from "matrix-js-sdk/src/matrix";
import { MatrixError, type MatrixClient, EventType, type EmptyObject, type InviteOpts } from "matrix-js-sdk/src/matrix";
import { KnownMembership } from "matrix-js-sdk/src/types";
import { logger } from "matrix-js-sdk/src/logger";
@@ -183,7 +183,11 @@ export default class MultiInviter {
}
}
return this.matrixClient.invite(roomId, addr, this.reason);
const opts: InviteOpts = {};
if (this.reason !== undefined) opts.reason = this.reason;
if (SettingsStore.getValue("feature_share_history_on_invite")) opts.shareEncryptedHistory = true;
return this.matrixClient.invite(roomId, addr, opts);
} else {
throw new Error("Unsupported address");
}