Bug 1745916 - Follow changes in matrix-js-sdk. r=clokep

Differential Revision: https://phabricator.services.mozilla.com/D133736

--HG--
extra : rebase_source : df31a36516125688cce68b775dd54a6358a2d78a
This commit is contained in:
Martin Giger 2021-12-14 11:51:54 +00:00
Родитель baec5ef3f9
Коммит e830267a6a
8 изменённых файлов: 131 добавлений и 128 удалений

Просмотреть файл

@ -5,130 +5,130 @@
# The Matrix SDK.
EXTRA_JS_MODULES.matrix.matrix_sdk += [
'matrix-sdk/autodiscovery.js',
'matrix-sdk/browser-index.js',
'matrix-sdk/client.js',
'matrix-sdk/content-helpers.js',
'matrix-sdk/content-repo.js',
'matrix-sdk/errors.js',
'matrix-sdk/event-mapper.js',
'matrix-sdk/filter-component.js',
'matrix-sdk/filter.js',
'matrix-sdk/http-api.js',
'matrix-sdk/indexeddb-helpers.js',
'matrix-sdk/indexeddb-worker.js',
'matrix-sdk/interactive-auth.js',
'matrix-sdk/logger.js',
'matrix-sdk/matrix.js',
'matrix-sdk/NamespacedValue.js',
'matrix-sdk/pushprocessor.js',
'matrix-sdk/randomstring.js',
'matrix-sdk/realtime-callbacks.js',
'matrix-sdk/ReEmitter.js',
'matrix-sdk/room-hierarchy.js',
'matrix-sdk/scheduler.js',
'matrix-sdk/service-types.js',
'matrix-sdk/sync-accumulator.js',
'matrix-sdk/sync.api.js',
'matrix-sdk/sync.js',
'matrix-sdk/timeline-window.js',
'matrix-sdk/utils.js',
"matrix-sdk/autodiscovery.js",
"matrix-sdk/browser-index.js",
"matrix-sdk/client.js",
"matrix-sdk/content-helpers.js",
"matrix-sdk/content-repo.js",
"matrix-sdk/errors.js",
"matrix-sdk/event-mapper.js",
"matrix-sdk/filter-component.js",
"matrix-sdk/filter.js",
"matrix-sdk/http-api.js",
"matrix-sdk/indexeddb-helpers.js",
"matrix-sdk/indexeddb-worker.js",
"matrix-sdk/interactive-auth.js",
"matrix-sdk/logger.js",
"matrix-sdk/matrix.js",
"matrix-sdk/NamespacedValue.js",
"matrix-sdk/pushprocessor.js",
"matrix-sdk/randomstring.js",
"matrix-sdk/realtime-callbacks.js",
"matrix-sdk/ReEmitter.js",
"matrix-sdk/room-hierarchy.js",
"matrix-sdk/scheduler.js",
"matrix-sdk/service-types.js",
"matrix-sdk/sync-accumulator.js",
"matrix-sdk/sync.api.js",
"matrix-sdk/sync.js",
"matrix-sdk/timeline-window.js",
"matrix-sdk/utils.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.crypto += [
'matrix-sdk/crypto/aes.js',
'matrix-sdk/crypto/api.js',
'matrix-sdk/crypto/backup.js',
'matrix-sdk/crypto/CrossSigning.js',
'matrix-sdk/crypto/dehydration.js',
'matrix-sdk/crypto/deviceinfo.js',
'matrix-sdk/crypto/DeviceList.js',
'matrix-sdk/crypto/EncryptionSetup.js',
'matrix-sdk/crypto/index.js',
'matrix-sdk/crypto/key_passphrase.js',
'matrix-sdk/crypto/OlmDevice.js',
'matrix-sdk/crypto/olmlib.js',
'matrix-sdk/crypto/OutgoingRoomKeyRequestManager.js',
'matrix-sdk/crypto/recoverykey.js',
'matrix-sdk/crypto/RoomList.js',
'matrix-sdk/crypto/SecretStorage.js',
"matrix-sdk/crypto/aes.js",
"matrix-sdk/crypto/api.js",
"matrix-sdk/crypto/backup.js",
"matrix-sdk/crypto/CrossSigning.js",
"matrix-sdk/crypto/dehydration.js",
"matrix-sdk/crypto/deviceinfo.js",
"matrix-sdk/crypto/DeviceList.js",
"matrix-sdk/crypto/EncryptionSetup.js",
"matrix-sdk/crypto/index.js",
"matrix-sdk/crypto/key_passphrase.js",
"matrix-sdk/crypto/OlmDevice.js",
"matrix-sdk/crypto/olmlib.js",
"matrix-sdk/crypto/OutgoingRoomKeyRequestManager.js",
"matrix-sdk/crypto/recoverykey.js",
"matrix-sdk/crypto/RoomList.js",
"matrix-sdk/crypto/SecretStorage.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.crypto.algorithms += [
'matrix-sdk/crypto/algorithms/base.js',
'matrix-sdk/crypto/algorithms/index.js',
'matrix-sdk/crypto/algorithms/megolm.js',
'matrix-sdk/crypto/algorithms/olm.js',
"matrix-sdk/crypto/algorithms/base.js",
"matrix-sdk/crypto/algorithms/index.js",
"matrix-sdk/crypto/algorithms/megolm.js",
"matrix-sdk/crypto/algorithms/olm.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.crypto.store += [
'matrix-sdk/crypto/store/indexeddb-crypto-store-backend.js',
'matrix-sdk/crypto/store/indexeddb-crypto-store.js',
'matrix-sdk/crypto/store/localStorage-crypto-store.js',
'matrix-sdk/crypto/store/memory-crypto-store.js',
"matrix-sdk/crypto/store/indexeddb-crypto-store-backend.js",
"matrix-sdk/crypto/store/indexeddb-crypto-store.js",
"matrix-sdk/crypto/store/localStorage-crypto-store.js",
"matrix-sdk/crypto/store/memory-crypto-store.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.crypto.verification += [
'matrix-sdk/crypto/verification/Base.js',
'matrix-sdk/crypto/verification/Error.js',
'matrix-sdk/crypto/verification/IllegalMethod.js',
'matrix-sdk/crypto/verification/QRCode.js',
'matrix-sdk/crypto/verification/SAS.js',
"matrix-sdk/crypto/verification/Base.js",
"matrix-sdk/crypto/verification/Error.js",
"matrix-sdk/crypto/verification/IllegalMethod.js",
"matrix-sdk/crypto/verification/QRCode.js",
"matrix-sdk/crypto/verification/SAS.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.crypto.verification.request += [
'matrix-sdk/crypto/verification/request/InRoomChannel.js',
'matrix-sdk/crypto/verification/request/ToDeviceChannel.js',
'matrix-sdk/crypto/verification/request/VerificationRequest.js',
"matrix-sdk/crypto/verification/request/InRoomChannel.js",
"matrix-sdk/crypto/verification/request/ToDeviceChannel.js",
"matrix-sdk/crypto/verification/request/VerificationRequest.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.models += [
'matrix-sdk/models/event-context.js',
'matrix-sdk/models/event-timeline-set.js',
'matrix-sdk/models/event-timeline.js',
'matrix-sdk/models/event.js',
'matrix-sdk/models/group.js',
'matrix-sdk/models/MSC3089Branch.js',
'matrix-sdk/models/MSC3089TreeSpace.js',
'matrix-sdk/models/relations.js',
'matrix-sdk/models/room-member.js',
'matrix-sdk/models/room-state.js',
'matrix-sdk/models/room-summary.js',
'matrix-sdk/models/room.js',
'matrix-sdk/models/search-result.js',
'matrix-sdk/models/thread.js',
'matrix-sdk/models/typed-event-emitter.js',
'matrix-sdk/models/user.js',
"matrix-sdk/models/event-context.js",
"matrix-sdk/models/event-timeline-set.js",
"matrix-sdk/models/event-timeline.js",
"matrix-sdk/models/event.js",
"matrix-sdk/models/group.js",
"matrix-sdk/models/MSC3089Branch.js",
"matrix-sdk/models/MSC3089TreeSpace.js",
"matrix-sdk/models/relations.js",
"matrix-sdk/models/room-member.js",
"matrix-sdk/models/room-state.js",
"matrix-sdk/models/room-summary.js",
"matrix-sdk/models/room.js",
"matrix-sdk/models/search-result.js",
"matrix-sdk/models/thread.js",
"matrix-sdk/models/typed-event-emitter.js",
"matrix-sdk/models/user.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.store += [
'matrix-sdk/store/indexeddb-local-backend.js',
'matrix-sdk/store/indexeddb-remote-backend.js',
'matrix-sdk/store/indexeddb-store-worker.js',
'matrix-sdk/store/indexeddb.js',
'matrix-sdk/store/local-storage-events-emitter.js',
'matrix-sdk/store/memory.js',
'matrix-sdk/store/stub.js',
"matrix-sdk/store/indexeddb-local-backend.js",
"matrix-sdk/store/indexeddb-remote-backend.js",
"matrix-sdk/store/indexeddb-store-worker.js",
"matrix-sdk/store/indexeddb.js",
"matrix-sdk/store/local-storage-events-emitter.js",
"matrix-sdk/store/memory.js",
"matrix-sdk/store/stub.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.store.session += [
'matrix-sdk/store/session/webstorage.js',
"matrix-sdk/store/session/webstorage.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.types += [
'matrix-sdk/@types/event.js',
'matrix-sdk/@types/partials.js',
'matrix-sdk/@types/PushRules.js',
'matrix-sdk/@types/search.js',
'matrix-sdk/@types/threepids.js',
"matrix-sdk/@types/event.js",
"matrix-sdk/@types/partials.js",
"matrix-sdk/@types/PushRules.js",
"matrix-sdk/@types/search.js",
"matrix-sdk/@types/threepids.js",
]
EXTRA_JS_MODULES.matrix.matrix_sdk.webrtc += [
'matrix-sdk/webrtc/call.js',
'matrix-sdk/webrtc/callEventHandler.js',
'matrix-sdk/webrtc/callEventTypes.js',
'matrix-sdk/webrtc/callFeed.js',
'matrix-sdk/webrtc/mediaHandler.js',
"matrix-sdk/webrtc/call.js",
"matrix-sdk/webrtc/callEventHandler.js",
"matrix-sdk/webrtc/callEventTypes.js",
"matrix-sdk/webrtc/callFeed.js",
"matrix-sdk/webrtc/mediaHandler.js",
]
# Dependencies of the Matrix SDK.
@ -136,46 +136,46 @@ EXTRA_JS_MODULES.matrix.matrix_sdk.webrtc += [
# Single file dependencies (with good names) are just added to the top-level
# matrix module.
EXTRA_JS_MODULES.matrix += [
'another-json/another-json.js',
'events/events.js',
'qs/dist/qs.js',
"another-json/another-json.js",
"events/events.js",
"qs/dist/qs.js",
]
EXTRA_JS_MODULES.matrix.base_x += [
'base-x/index.js',
"base-x/index.js",
]
EXTRA_JS_MODULES.matrix.browser_request += [
'browser-request/index.js',
"browser-request/index.js",
]
EXTRA_JS_MODULES.matrix.bs58 += [
'bs58/index.js',
"bs58/index.js",
]
EXTRA_JS_MODULES.matrix.content_type += [
'content-type/index.js',
"content-type/index.js",
]
EXTRA_JS_MODULES.matrix.unhomoglyph += [
'unhomoglyph/data.json',
'unhomoglyph/index.js',
"unhomoglyph/data.json",
"unhomoglyph/index.js",
]
EXTRA_JS_MODULES.matrix.olm += [
'@matrix-org/olm/olm.js',
'@matrix-org/olm/olm.wasm',
"@matrix-org/olm/olm.js",
"@matrix-org/olm/olm.wasm",
]
EXTRA_JS_MODULES.matrix.p_retry += [
'p-retry/index.js',
"p-retry/index.js",
]
EXTRA_JS_MODULES.matrix.retry += [
'retry/index.js',
"retry/index.js",
]
EXTRA_JS_MODULES.matrix.retry.lib += [
'retry/lib/retry.js',
'retry/lib/retry_operation.js',
"retry/lib/retry.js",
"retry/lib/retry_operation.js",
]

Просмотреть файл

@ -424,9 +424,11 @@ MatrixRoom.prototype = {
*/
sendMsg(msg) {
this.sendTyping("");
this._account._client.sendTextMessage(this._roomId, msg).catch(error => {
this._account.ERROR("Failed to send message to: " + this._roomId);
});
this._account._client
.sendTextMessage(this._roomId, null, msg)
.catch(error => {
this._account.ERROR("Failed to send message to: " + this._roomId);
});
},
/**
@ -626,7 +628,7 @@ MatrixRoom.prototype = {
this._account._client.getHomeserverUrl(),
eventId => this.room.findEventById(eventId)
);
if (eventContent.msgtype === EventType.KeyVerificationRequest) {
if (eventContent.msgtype === MsgType.KeyVerificationRequest) {
message = getMatrixTextForEvent(event);
}
this.writeMessage(event.getSender(), message, {
@ -636,7 +638,7 @@ MatrixRoom.prototype = {
MsgType.Notice,
"m.server_notice",
"m.bad.encrypted",
EventType.KeyVerificationRequest,
MsgType.KeyVerificationRequest,
].includes(eventContent.msgtype),
time: Math.floor(event.getDate() / 1000),
_alias: event.sender.name,

Просмотреть файл

@ -433,7 +433,7 @@ var commands = [
},
run: clientCommand("sendEmoteMessage", 1, {
formatParams(conv, [message]) {
return [conv._roomId, message];
return [conv._roomId, null, message];
},
}),
},

Просмотреть файл

@ -167,10 +167,7 @@ function formatHTMLBody(event, homeserverUrl, getEvent, includeReply = true) {
const reply = parsedBody.querySelector("mx-reply");
if (reply) {
if (includeReply && content.msgtype != MsgType.Emote) {
//TODO use event.replyEventId when updating matrix-js-sdk
const eventId = event.getWireContent()?.["m.relates_to"]?.[
"m.in_reply_to"
]?.event_id;
const eventId = event.replyEventId;
const replyEvent = getEvent(eventId);
if (replyEvent) {
let replyContent = getReplyContent(
@ -229,10 +226,7 @@ var MatrixMessageContent = {
if (type == EventType.RoomMessage) {
if (kRichBodiedTypes.includes(content.msgtype)) {
let body = TXTToHTML(content.body);
//TODO use event.replyEventId when updating matrix-js-sdk
const eventId = event.getWireContent()?.["m.relates_to"]?.[
"m.in_reply_to"
]?.event_id;
const eventId = event.replyEventId;
if (body.startsWith(">") && eventId) {
let nonQuote = Number.MAX_SAFE_INTEGER;
const replyEvent = getEvent(eventId);

Просмотреть файл

@ -7,7 +7,9 @@ this.EXPORTED_SYMBOLS = ["getMatrixTextForEvent"];
var { XPCOMUtils, l10nHelper } = ChromeUtils.import(
"resource:///modules/imXPCOMUtils.jsm"
);
var { EventType } = ChromeUtils.import("resource:///modules/matrix-sdk.jsm");
var { EventType, MsgType } = ChromeUtils.import(
"resource:///modules/matrix-sdk.jsm"
);
XPCOMUtils.defineLazyGetter(this, "_", () =>
l10nHelper("chrome://chat/locale/matrix.properties")
@ -37,7 +39,7 @@ const keyVerificationRequest = (matrixEvent, { sender, content }) => {
const roomMessage = {
pivot: "msgtype",
handlers: {
[EventType.KeyVerificationRequest]: keyVerificationRequest,
[MsgType.KeyVerificationRequest]: keyVerificationRequest,
},
};

Просмотреть файл

@ -221,5 +221,7 @@ function makeEvent(eventSpec = {}) {
return false;
},
target: eventSpec.target,
replyEventId:
eventSpec.content?.["m.relates_to"]?.["m.in_reply_to"]?.event_id,
};
}

Просмотреть файл

@ -529,8 +529,9 @@ add_task(function test_sendMsg() {
isTyping = typing;
return Promise.resolve();
},
sendTextMessage(roomId, msg) {
sendTextMessage(roomId, threadId, msg) {
equal(roomId, roomStub._roomId);
equal(threadId, null);
message = msg;
return Promise.resolve();
},

Просмотреть файл

@ -5,7 +5,9 @@ var { getMatrixTextForEvent } = ChromeUtils.import(
"resource:///modules/matrixTextForEvent.jsm"
);
var { l10nHelper } = ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
var { EventType } = ChromeUtils.import("resource:///modules/matrix-sdk.jsm");
var { EventType, MsgType } = ChromeUtils.import(
"resource:///modules/matrix-sdk.jsm"
);
var _ = l10nHelper("chrome://chat/locale/matrix.properties");
function run_test() {
@ -767,7 +769,7 @@ const FIXTURES = [
event: makeEvent({
type: EventType.RoomMessage,
content: {
msgtype: EventType.KeyVerificationRequest,
msgtype: MsgType.KeyVerificationRequest,
to: "@foo:example.com",
},
sender: SENDER,