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 public function create(string $title, string $content): DataResponse
{ {
return new DataResponse($this->service->create($title, $content, $this->userId)); return new DataResponse($this->service->create($title, $content, $this->userId));
} }
/**
* @NoAdminRequired
*/
public function update(int $id, string $title, string $content): DataResponse public function update(int $id, string $title, string $content): DataResponse
{ {
return $this->handleNotFound(function () use ($id, $title, $content) { return $this->handleNotFound(function () use ($id, $title, $content) {

View file

@ -63,7 +63,7 @@ class Version000000Date20210918151800 extends SimpleMigrationStep {
]); ]);
$table->addColumn('user_id', 'string', [ $table->addColumn('user_id', 'string', [
'notnull' => true, 'notnull' => true,
'length' => 200, 'length' => 64,
]); ]);
$table->addColumn('matrix_user', 'string', [ $table->addColumn('matrix_user', 'string', [
'notnull' => true, 'notnull' => true,
@ -77,7 +77,7 @@ class Version000000Date20210918151800 extends SimpleMigrationStep {
$table->setPrimaryKey(['id']); $table->setPrimaryKey(['id']);
$table->addUniqueConstraint(['user_id'], 'upschooling_mx_user_nc_uniq'); $table->addUniqueConstraint(['user_id'], 'upschooling_mx_user_nc_uniq');
$table->addUniqueConstraint(['matrix_user'], 'upschooling_mx_user_mx_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; return $schema;
} }

View file

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

View file

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