def add_staff_as_moderator(sender, instance, created, **kwargs):  # pylint: disable=unused-argument
    """
    Signal handler add user as moderator when his staff role on program is added
    """
    if not settings.FEATURES.get('OPEN_DISCUSSIONS_USER_SYNC', False):
        return

    if instance.role not in Role.permission_to_roles[Permissions.CAN_CREATE_FORUMS]:
        return

    transaction.on_commit(
        lambda: tasks.add_user_as_moderator_to_channel.delay(
            instance.user_id,
            instance.program_id,
        )
    )