You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-06 12:02:40 +03:00
Update some more
This commit is contained in:
@@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IPublicRoomsChunk } from "../client";
|
import { IPublicRoomsChunkRoom } from "../client";
|
||||||
|
|
||||||
// Types relating to Rooms of type `m.space` and related APIs
|
// Types relating to Rooms of type `m.space` and related APIs
|
||||||
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
export interface ISpaceSummaryRoom extends IPublicRoomsChunk {
|
export interface ISpaceSummaryRoom extends IPublicRoomsChunkRoom {
|
||||||
num_refs: number;
|
num_refs: number;
|
||||||
room_type: string;
|
room_type: string;
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ limitations under the License.
|
|||||||
|
|
||||||
import { EventEmitter } from "events";
|
import { EventEmitter } from "events";
|
||||||
import { ISyncStateData, SyncApi } from "./sync";
|
import { ISyncStateData, SyncApi } from "./sync";
|
||||||
import { EventStatus, IContent, IDecryptOptions, MatrixEvent } from "./models/event";
|
import { EventStatus, IContent, IDecryptOptions, IEvent, MatrixEvent } from "./models/event";
|
||||||
import { StubStore } from "./store/stub";
|
import { StubStore } from "./store/stub";
|
||||||
import { createNewMatrixCall, MatrixCall } from "./webrtc/call";
|
import { createNewMatrixCall, MatrixCall } from "./webrtc/call";
|
||||||
import { Filter, IFilterDefinition } from "./filter";
|
import { Filter, IFilterDefinition } from "./filter";
|
||||||
@@ -556,7 +556,7 @@ interface IRoomInitialSyncResponse {
|
|||||||
state?: IStateEventWithRoomId[];
|
state?: IStateEventWithRoomId[];
|
||||||
visibility: Visibility;
|
visibility: Visibility;
|
||||||
account_data?: IMinimalEvent[];
|
account_data?: IMinimalEvent[];
|
||||||
presence: any; // undocumented
|
presence: Partial<IEvent>; // legacy and undocumented, api is deprecated so this won't get attention
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IJoinedMembersResponse {
|
interface IJoinedMembersResponse {
|
||||||
@@ -568,7 +568,7 @@ interface IJoinedMembersResponse {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPublicRoomsChunk {
|
export interface IPublicRoomsChunkRoom {
|
||||||
room_id: string;
|
room_id: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
avatar_url?: string;
|
avatar_url?: string;
|
||||||
@@ -581,7 +581,7 @@ export interface IPublicRoomsChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface IPublicRoomsResponse {
|
interface IPublicRoomsResponse {
|
||||||
chunk: IPublicRoomsChunk[];
|
chunk: IPublicRoomsChunkRoom[];
|
||||||
next_batch?: string;
|
next_batch?: string;
|
||||||
prev_batch?: string;
|
prev_batch?: string;
|
||||||
total_room_count_estimate?: number;
|
total_room_count_estimate?: number;
|
||||||
@@ -657,7 +657,7 @@ export interface IInstance {
|
|||||||
icon?: string;
|
icon?: string;
|
||||||
fields: object;
|
fields: object;
|
||||||
network_id: string;
|
network_id: string;
|
||||||
// XXX: this is undocumented but we rely on it.
|
// XXX: this is undocumented but we rely on it: https://github.com/matrix-org/matrix-doc/issues/3203
|
||||||
instance_id: string;
|
instance_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,9 +15,9 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { MatrixClient } from "./client";
|
import { MatrixClient } from "./client";
|
||||||
import { MatrixEvent } from "./models/event";
|
import { IEvent, MatrixEvent } from "./models/event";
|
||||||
|
|
||||||
export type EventMapper = (obj: any) => MatrixEvent;
|
export type EventMapper = (obj: Partial<IEvent>) => MatrixEvent;
|
||||||
|
|
||||||
export interface MapperOpts {
|
export interface MapperOpts {
|
||||||
preventReEmit?: boolean;
|
preventReEmit?: boolean;
|
||||||
@@ -28,7 +28,7 @@ export function eventMapperFor(client: MatrixClient, options: MapperOpts): Event
|
|||||||
const preventReEmit = Boolean(options.preventReEmit);
|
const preventReEmit = Boolean(options.preventReEmit);
|
||||||
const decrypt = options.decrypt !== false;
|
const decrypt = options.decrypt !== false;
|
||||||
|
|
||||||
function mapper(plainOldJsObject) {
|
function mapper(plainOldJsObject: Partial<IEvent>) {
|
||||||
const event = new MatrixEvent(plainOldJsObject);
|
const event = new MatrixEvent(plainOldJsObject);
|
||||||
if (event.isEncrypted()) {
|
if (event.isEncrypted()) {
|
||||||
if (!preventReEmit) {
|
if (!preventReEmit) {
|
||||||
|
@@ -329,8 +329,7 @@ export class SyncApi {
|
|||||||
const stateEvents = response.state.map(client.getEventMapper());
|
const stateEvents = response.state.map(client.getEventMapper());
|
||||||
const messages = response.messages.chunk.map(client.getEventMapper());
|
const messages = response.messages.chunk.map(client.getEventMapper());
|
||||||
|
|
||||||
// XXX: copypasted from /sync until we kill off this
|
// XXX: copypasted from /sync until we kill off this minging v1 API stuff)
|
||||||
// minging v1 API stuff)
|
|
||||||
// handle presence events (User objects)
|
// handle presence events (User objects)
|
||||||
if (response.presence && Array.isArray(response.presence)) {
|
if (response.presence && Array.isArray(response.presence)) {
|
||||||
response.presence.map(client.getEventMapper()).forEach(
|
response.presence.map(client.getEventMapper()).forEach(
|
||||||
|
Reference in New Issue
Block a user