How to use the m.server_notice function in m

To help you get started, we’ve selected a few m 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 FabricLabs / fabric / src / components / structures / LoggedInView.js View on Github external
onRoomStateEvents: function(ev, state) {
        const roomLists = RoomListStore.getRoomLists();
        if (roomLists['m.server_notice'] && roomLists['m.server_notice'].some(r => r.roomId === ev.getRoomId())) {
            this._updateServerNoticeEvents();
        }
    },
github FabricLabs / fabric / src / components / structures / LoggedInView.js View on Github external
_updateServerNoticeEvents: async function() {
        const roomLists = RoomListStore.getRoomLists();
        if (!roomLists['m.server_notice']) return [];

        const pinnedEvents = [];
        for (const room of roomLists['m.server_notice']) {
            const pinStateEvent = room.currentState.getStateEvents("m.room.pinned_events", "");

            if (!pinStateEvent || !pinStateEvent.getContent().pinned) continue;

            const pinnedEventIds = pinStateEvent.getContent().pinned.slice(0, MAX_PINNED_NOTICES_PER_ROOM);
            for (const eventId of pinnedEventIds) {
                const timeline = await this._matrixClient.getEventTimeline(room.getUnfilteredTimelineSet(), eventId, 0);
                const ev = timeline.getEvents().find(ev => ev.getId() === eventId);
                if (ev) pinnedEvents.push(ev);
            }
        }
        this.setState({
            serverNoticeEvents: pinnedEvents,
        });
    },
github FabricLabs / fabric / src / components / views / rooms / RoomList.js View on Github external
label: _t('Low priority'),
                tagName: "m.lowpriority",
                order: "recent",
                incomingCall: incomingCallIfTaggedAs('m.lowpriority'),
            },
            {
                list: this.state.lists['im.vector.fake.archived'],
                label: _t('Historical'),
                order: "recent",
                incomingCall: incomingCallIfTaggedAs('im.vector.fake.archived'),
                startAsHidden: true,
                showSpinner: this.state.isLoadingLeftRooms,
                onHeaderClick: this.onArchivedHeaderClick,
            },
            {
                list: this.state.lists['m.server_notice'],
                label: _t('System Alerts'),
                tagName: "m.lowpriority",
                order: "recent",
                incomingCall: incomingCallIfTaggedAs('m.server_notice'),
            },
        ]);

        const subListComponents = this._mapSubListProps(subLists);

        return (
            <div>
                { subListComponents }
            </div>
        );
    },
github FabricLabs / fabric / src / components / structures / LoggedInView.js View on Github external
_updateServerNoticeEvents: async function() {
        const roomLists = RoomListStore.getRoomLists();
        if (!roomLists['m.server_notice']) return [];

        const pinnedEvents = [];
        for (const room of roomLists['m.server_notice']) {
            const pinStateEvent = room.currentState.getStateEvents("m.room.pinned_events", "");

            if (!pinStateEvent || !pinStateEvent.getContent().pinned) continue;

            const pinnedEventIds = pinStateEvent.getContent().pinned.slice(0, MAX_PINNED_NOTICES_PER_ROOM);
            for (const eventId of pinnedEventIds) {
                const timeline = await this._matrixClient.getEventTimeline(room.getUnfilteredTimelineSet(), eventId, 0);
                const ev = timeline.getEvents().find(ev => ev.getId() === eventId);
                if (ev) pinnedEvents.push(ev);
            }
        }
        this.setState({
            serverNoticeEvents: pinnedEvents,