Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

ModuleAPI: provide method to resolve room_alias to room_id #13359

@uriesk

Description

@uriesk

I am writing a pluggable module that joins rooms on login,
and i resolve room alias to id with:

    async def translate_room_aliases_to_ids(
        self,
        room_aliases: List[str],
    ) -> List[str]:
        room_ids = []
        logger.info('Translating room_aliases to ids')
        for alias in room_aliases:
            aliasObject = RoomAlias.from_string(alias)
            room = await self.api._store.get_association_from_room_alias(aliasObject)
            if room is not None:
                logger.info('Map alias %s to room %s', alias, room.room_id)
                room_ids.append(room.room_id)
        return room_ids;

Which isn't great, because i go through api._store.
Would be nice to have such a functionality in the api itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ModulesModule API: https://matrix-org.github.io/synapse/latest/modules/index.htmlT-EnhancementNew features, changes in functionality, improvements in performance, or user-facing enhancements.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions