Skip to content
Snippets Groups Projects
tasks.py 516 B
Newer Older
from typing import Sequence

from aleksis.apps.matrix.models import MatrixRoom
from aleksis.core.celery import app
from aleksis.core.models import Group


@app.task
def sync_room(pk: int):
    room = MatrixRoom.objects.get(pk=pk)
    room.sync()


@app.task
def use_groups_in_matrix(pks: Sequence[int]):
    groups = Group.objects.filter(pk__in=pks)
    for group in groups:
        group._use_in_matrix()


@app.task
def use_group_in_matrix(pk: int):
    group = Group.objects.get(pk=pk)
    group._use_in_matrix()