Small fixes

This commit is contained in:
Ben 2021-09-21 20:22:56 +02:00
parent 01212543fe
commit c82acc8f52
Signed by: ben
GPG key ID: 0F54A7ED232D3319
4 changed files with 14 additions and 4 deletions

View file

@ -43,11 +43,17 @@ class TicketApiController extends ApiController
});
}
/**
* @NoAdminRequired
*/
public function create(string $title, string $content): DataResponse
{
return new DataResponse($this->service->create($title, $content, $this->userId));
}
/**
* @NoAdminRequired
*/
public function update(int $id, string $title, string $content): DataResponse
{
return $this->handleNotFound(function () use ($id, $title, $content) {

View file

@ -63,7 +63,7 @@ class Version000000Date20210918151800 extends SimpleMigrationStep {
]);
$table->addColumn('user_id', 'string', [
'notnull' => true,
'length' => 200,
'length' => 64,
]);
$table->addColumn('matrix_user', 'string', [
'notnull' => true,
@ -77,7 +77,7 @@ class Version000000Date20210918151800 extends SimpleMigrationStep {
$table->setPrimaryKey(['id']);
$table->addUniqueConstraint(['user_id'], 'upschooling_mx_user_nc_uniq');
$table->addUniqueConstraint(['matrix_user'], 'upschooling_mx_user_mx_uniq');
$table->addForeignKeyConstraint('users', ['user_id'], ['id'], [], 'upschooling_mx_user_nc_fk');
$table->addForeignKeyConstraint('users', ['user_id'], ['uid'], [], 'upschooling_mx_user_nc_fk');
}
return $schema;
}

View file

@ -114,7 +114,8 @@ class MatrixService
null,
[],
[],
'/_synapse/admin/v1', true
'/_synapse/admin/v1',
true
);
$randUsername = trim(str_replace(["/", "+"], ".", base64_encode(random_bytes(6))), "=");
$username = "upschooling_" . $randUsername;
@ -134,7 +135,8 @@ class MatrixService
),
[],
[],
'/_synapse/admin/v1', true
'/_synapse/admin/v1',
true
);
$matrixUser = new MatrixUser();

View file

@ -48,6 +48,8 @@ class TicketService {
// id is to be set from the remote support-platform Nextcloud
"title" => $title,
"description" => $content,
"status" => "open",
"version" => "1",
));
$ticket = new MatrixTicket();
$ticket->setMatrixRoom($roomId);