From 8868a90bdf2a2f3ee03396bf40f13e18ca612649 Mon Sep 17 00:00:00 2001
From: Thomas Hackl <hackl@data-quest.de>
Date: Fri, 13 May 2022 13:49:44 +0200
Subject: [PATCH] set user_id manually if token is given

---
 models/MatrixAccount.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/models/MatrixAccount.php b/models/MatrixAccount.php
index 276f186..9e75d29 100644
--- a/models/MatrixAccount.php
+++ b/models/MatrixAccount.php
@@ -63,6 +63,8 @@ class MatrixAccount extends SimpleORMap
             // Access token specified, use this (and skip login because the token can be used directly).
             if (trim(Config::get()->MATRIX_SYSTEM_ACCOUNT_ACCESS_TOKEN) != '') {
                 $account = new Patrix\Account(trim(Config::get()->MATRIX_SYSTEM_ACCOUNT_USERNAME), '');
+                $account->setUserId(
+                    '@' . Config::get()->MATRIX_SYSTEM_ACCOUNT_USERNAME . ':' . MATRIX_ACCOUNTS_LOCAL_PART);
                 $account->setAccessData(trim(Config::get()->MATRIX_SYSTEM_ACCOUNT_ACCESS_TOKEN), 'Stud.IP');
             // No token, login by username and password.
             } else {
-- 
GitLab