Revert sprememb, reseno na drugem branchu

pull/57/head
Jurij Podgoršek 2024-05-10 19:24:46 +02:00
parent 9e81be6be2
commit 9d50577f51
1 changed files with 6 additions and 13 deletions

View File

@ -90,11 +90,11 @@ class AddConcept extends ResourceBase {
}
/**
* Ustvari nov ali uredi obstoječ koncept.
* Ustvari nov koncept.
*
* Logika:
* 1. Zloadamo uporabnika preko emaila, ce ne obstaja, ga ustvarimo.
* 2. Zloadamo koncept prek uuid, ce ne obstaja, ga ustvarimo.
* 2. Zloadamo koncept prek uuid, ce ne obstaja, da ustvarimo.
* - avtor je zloadan prek maila
*
* @param \Symfony\Component\HttpFoundation\Request;
@ -117,14 +117,11 @@ class AddConcept extends ResourceBase {
throw new MissingDataException('Title, uuid or text missing.');
}
$uid = $this->getUserIdByEmail($data['email'] ?? null);
// @TODO - loudaj zadnjo revizijo in primerjaj z entiteto, je
// razlika?
// Kako dodati revizijo, ki je draft?
if ($concept = $this->getConceptFromUuid($data['uuid'])) {
// Concept exists - create a new revision.
$oldConcept = clone $concept;
$concept->setNewRevision(TRUE);
$concept->setRevisionUserId($uid);
$concept->setRevisionCreationTime(\Drupal::time()->getRequestTime());
$concept->set('title', $data['title']);
$concept->set('body', $data['text'] ?? $concept->body->value);
if ($uid) {
@ -142,12 +139,8 @@ class AddConcept extends ResourceBase {
'@revid' => $concept->getRevisionId(),
'@uid' => $uid,
]);
/*
$oldConcept->isDefaultRevision(TRUE);
$oldConcept->save();
*/
} else {
}
else {
// Concept does not exist - create a new node.
$concept = [
'type' => 'concept',