A container for ignored invites.

Performance

This implementation is extremely naive. It expects that we are dealing with a very short list of sources (e.g. only one). If real-world applications turn out to require longer lists, we may need to rework our data structures.

Hierarchy

  • IgnoredInvites

Constructors

Properties

client: MatrixClient

Methods

  • Add a new rule.

    Returns

    The event id for the new rule.

    Parameters

    • scope: PolicyScope

      The scope for this rule.

    • entity: string

      The entity covered by this rule. Globs are supported.

    • reason: string

      A human-readable reason for introducing this new rule.

    Returns Promise<string>

  • Add a new room to the list of sources. If the user isn't a member of the room, attempt to join it.

    Returns

    true if the source was added, false if it was already present.

    Throws

    If roomId isn't the id of a room that the current user is already member of or can join.

    Safety

    This method will rewrite the Policies object in the user's account data. This rewrite is inherently racy and could overwrite or be overwritten by other concurrent rewrites of the same object.

    Parameters

    • roomId: string

      A valid room id. If this room is already in the list of sources, it will not be duplicated.

    Returns Promise<boolean>

  • Fetch the IGNORE_INVITES_POLICIES object from account data.

    If both an unstable prefix version and a stable prefix version are available, it will return the stable prefix version preferentially.

    The result is not validated but is guaranteed to be a non-null object.

    Returns

    A non-null object.

    Returns {
        [key: string]: any;
    }

    • [key: string]: any
  • Get the list of source rooms, i.e. the rooms from which rules need to be read.

    If no source rooms are setup, the target room is used as sole source room.

    Note: This method is public for testing reasons. Most clients should not need to call it directly.

    Safety

    This method will rewrite the Policies object in the user's account data. This rewrite is inherently racy and could overwrite or be overwritten by other concurrent rewrites of the same object.

    Returns Promise<Room[]>

  • Get the target room, i.e. the room in which any new rule should be written.

    If there is no target room setup, a target room is created.

    Note: This method is public for testing reasons. Most clients should not need to call it directly.

    Safety

    This method will rewrite the Policies object in the user's account data. This rewrite is inherently racy and could overwrite or be overwritten by other concurrent rewrites of the same object.

    Returns Promise<Room>

  • As getIgnoreInvitesPolicies but also return the POLICIES_ACCOUNT_EVENT_TYPE object.

    Returns {
        ignoreInvitesPolicies: {
            [key: string]: any;
        };
        policies: {
            [key: string]: any;
        };
    }

    • ignoreInvitesPolicies: {
          [key: string]: any;
      }
      • [key: string]: any
    • policies: {
          [key: string]: any;
      }
      • [key: string]: any
  • Find out whether an invite should be ignored.

    Returns

    A rule matching the entity, if any was found, null otherwise.

    Parameters

    • __namedParameters: {
          roomId: string;
          sender: string;
      }
      • roomId: string
      • sender: string

    Returns Promise<Readonly<null | MatrixEvent>>

  • Modify in place the IGNORE_INVITES_POLICIES object from account data.

    Parameters

    • cb: ((ignoreInvitesPolicies: {
          [key: string]: any;
      }) => void)
        • (ignoreInvitesPolicies: {
              [key: string]: any;
          }): void
        • Parameters

          • ignoreInvitesPolicies: {
                [key: string]: any;
            }
            • [key: string]: any

          Returns void

    Returns Promise<void>

Generated using TypeDoc