How to use the matrix-js-sdk/lib/pushprocessor.actionListToActionsObject 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 FabricLabs / fabric / src / RoomNotifs.js View on Github external
} catch (err) {
        // Possible that the client doesn't have pushRules yet. If so, it
        // hasn't started eiher, so indicate that this room is not notifying.
        return null;
    }

    // XXX: We have to assume the default is to notify for all messages
    // (in particular this will be 'wrong' for one to one rooms because
    // they will notify loudly for all messages)
    if (!roomRule || !roomRule.enabled) return ALL_MESSAGES;

    // a mute at the room level will still allow mentions
    // to notify
    if (isMuteRule(roomRule)) return MENTIONS_ONLY;

    const actionsObject = PushProcessor.actionListToActionsObject(roomRule.actions);
    if (actionsObject.tweaks.sound) return ALL_MESSAGES_LOUD;

    return null;
}
github vector-im / riot-web / src / notifications / RoomNotifs.js View on Github external
return 'mute';
    }

    // for everything else, look at the room rule.
    const roomRule = MatrixClientPeg.get().getRoomPushRule('global', roomId);

    // XXX: We have to assume the default is to notify for all messages
    // (in particular this will be 'wrong' for one to one rooms because
    // they will notify loudly for all messages)
    if (!roomRule || !roomRule.enabled) return 'all_messages';

    // a mute at the room level will still allow mentions
    // to notify
    if (isMuteRule(roomRule)) return 'mentions_only';

    const actionsObject = PushProcessor.actionListToActionsObject(roomRule.actions);
    if (actionsObject.tweaks.sound) return 'all_messages_loud';

    return null;
}