matrix-js-sdk
    Index

    Constructors

    Methods

    • Get one of the users push rules by its ID

      Parameters

      • ruleId: string

        The ID of the rule to search for

      Returns null | { kind: PushRuleKind; rule: IPushRule }

      rule The push rule, or null if no such rule was found

    • Get one of the users push rules by its ID

      Parameters

      • ruleId: string

        The ID of the rule to search for

      Returns null | IPushRule

      The push rule, or null if no such rule was found

    • Pre-caches the parsed keys for push rules and cleans out any obsolete cache entries. Should be called after push rules are updated.

      Parameters

      Returns void

    • Convert a list of actions into a object with the actions as keys and their values

      Parameters

      Returns IActionsObject

      A object with key 'notify' (true or false) and an object of actions

      eg. `[ 'notify', { set_tweak: 'sound', value: 'default' } ]`
      becomes `{ notify: true, tweaks: { sound: 'default' } }`
    • Create a RegExp object for the given glob pattern with a single capture group around the pattern itself, caching the result. No cache invalidation is present currently, as this will be inherently bounded to the size of the user's own push rules.

      Parameters

      • pattern: string

        the glob pattern to convert to a RegExp

      • alignToWordBoundary: boolean = false

        whether to align the pattern to word boundaries, as specified for content.body matches, will use lookaround assertions to ensure the match only includes the pattern

      • flags: string = "i"

        the flags to pass to the RegExp constructor, defaults to case-insensitive

      Returns RegExp

    • Internal

      Parse the key into the separate fields to search by splitting on unescaped ".", and then removing any escape characters.

      Parameters

      • str: string

        The key of the push rule condition: a dotted field.

      Returns string[]

      The unescaped parts to fetch.

    • Rewrites conditions on a client's push rules to match the defaults where applicable. Useful for upgrading push rules to more strict conditions when the server is falling behind on defaults.

      Parameters

      • incomingRules: IPushRules

        The client's existing push rules

      • userId: undefined | string = undefined

        The Matrix ID of the client.

      Returns IPushRules

      The rewritten rules

    MMNEPVFCICPMFPCPTTAAATR