How to use the matrix-js-sdk.Filter function in matrix-js-sdk

To help you get started, we’ve selected a few matrix-js-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lukebarnard1 / journal / src / logic / main.js View on Github external
cli.joinRoom(currentRoomId).done((room) => {
            let trackedRoomsJSON = localStorage.getItem('mx_tracked_rooms');
            if (!trackedRoomsJSON) {
                trackedRooms = [room.roomId];
            } else {
                trackedRooms = JSON.parse(trackedRoomsJSON);
                if (trackedRooms.indexOf(room.roomId) === -1) {
                    trackedRooms.push(room.roomId);
                }
            }

            localStorage.setItem('mx_tracked_rooms', JSON.stringify(trackedRooms));

            // Fudge a filter into the syncApi
            let f = new matrixSdk.Filter(creds.user_id);
            f.setDefinition({
                "account_data": {
                    "not_types": [
                      "*"
                    ],
                },
                "room": {
                    "rooms": trackedRooms,
                    "account_data": {
                        "limit": 0,
                    },
                    "state": {
                        "types": [
                            "m.room.aliases",
                            "m.room.canonical_alias",
                            "m.room.member",
github FabricLabs / fabric / src / components / structures / FilePanel.js View on Github external
updateTimelineSet: function(roomId) {
        const client = MatrixClientPeg.get();
        const room = client.getRoom(roomId);

        this.noRoom = !room;

        if (room) {
            const filter = new Matrix.Filter(client.credentials.userId);
            filter.setDefinition(
                {
                    "room": {
                        "timeline": {
                            "contains_url": true,
                            "types": [
                                "m.room.message",
                            ],
                        },
                    },
                },
            );

            // FIXME: we shouldn't be doing this every time we change room - see comment above.
            client.getOrCreateFilter("FILTER_FILES_" + client.credentials.userId, filter).then(
                (filterId)=>{
github gluon-project / gluon-rxp / src / Services / Matrix / index.ts View on Github external
export const createFileFilter = () => {
  fileFilter = new Matrix.Filter(client.credentials.userId)
  fileFilter.setDefinition(
    {
      room: {
        timeline: {
          contains_url: true,
          types: [
              'm.room.message',
          ],
        },
      },
    },
  )

  client.getOrCreateFilter('FILTER_FILES_' + client.credentials.userId, fileFilter).then(
      (filterId: string) => {
        fileFilter.filterId = filterId