How to use the m.heroes 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 mozilla / releases-comm-central / chat / protocols / matrix / lib / matrix-sdk / models / room.js View on Github external
Room.prototype.setSummary = function (summary) {
    const heroes = summary["m.heroes"];
    const joinedCount = summary["m.joined_member_count"];
    const invitedCount = summary["m.invited_member_count"];
    if (Number.isInteger(joinedCount)) {
        this.currentState.setJoinedMemberCount(joinedCount);
    }
    if (Number.isInteger(invitedCount)) {
        this.currentState.setInvitedMemberCount(invitedCount);
    }
    if (Array.isArray(heroes)) {
        // be cautious about trusting server values,
        // and make sure heroes doesn't contain our own id
        // just to be sure
        this._summaryHeroes = heroes.filter(userId => {
            return userId !== this.myUserId;
        });
    }
github matrix-org / matrix-js-sdk / src / models / room.js View on Github external
Room.prototype.setSummary = function(summary) {
    const heroes = summary["m.heroes"];
    const joinedCount = summary["m.joined_member_count"];
    const invitedCount = summary["m.invited_member_count"];
    if (Number.isInteger(joinedCount)) {
        this.currentState.setJoinedMemberCount(joinedCount);
    }
    if (Number.isInteger(invitedCount)) {
        this.currentState.setInvitedMemberCount(invitedCount);
    }
    if (Array.isArray(heroes)) {
        // be cautious about trusting server values,
        // and make sure heroes doesn't contain our own id
        // just to be sure
        this._summaryHeroes = heroes.filter((userId) => {
            return userId !== this.myUserId;
        });
    }
github matrix-org / matrix-js-sdk / src / models / room.js View on Github external
Room.prototype.setSummary = function(summary) {
    const heroes = summary["m.heroes"];
    const joinedCount = summary["m.joined_member_count"];
    const invitedCount = summary["m.invited_member_count"];
    if (Number.isInteger(joinedCount)) {
        this.currentState.setJoinedMemberCount(joinedCount);
    }
    if (Number.isInteger(invitedCount)) {
        this.currentState.setInvitedMemberCount(invitedCount);
    }
    if (Array.isArray(heroes)) {
        // be cautious about trusting server values,
        // and make sure heroes doesn't contain our own id
        // just to be sure
        this._summaryHeroes = heroes.filter((userId) => {
            return userId !== this.myUserId;
        });
    }
github matrix-org / matrix-js-sdk / spec / unit / sync-accumulator.spec.js View on Github external
it("should copy summary properties", function() {
            sa.accumulate(createSyncResponseWithSummary({
                "m.heroes": ["@alice:bar"],
                "m.invited_member_count": 2,
            }));
            const summary = sa.getJSON().roomsData.join["!foo:bar"].summary;
            expect(summary["m.invited_member_count"]).toEqual(2);
            expect(summary["m.heroes"]).toEqual(["@alice:bar"]);
        });
github bwindels / brawl-chat / src / matrix / room / summary.js View on Github external
_updateSummary(summary) {
		const heroes = summary["m.heroes"];
		const inviteCount = summary["m.joined_member_count"];
		const joinCount = summary["m.invited_member_count"];

		if (heroes) {
			this._heroes = heroes;
		}
		if (Number.isInteger(inviteCount)) {
			this._inviteCount = inviteCount;
		}
		if (Number.isInteger(joinCount)) {
			this._joinCount = joinCount;
		}
	}
}