@@ -269,6 +269,7 @@ public function newForm(): DataResponse {
269269 $ form ->setShowExpiration (false );
270270 $ form ->setExpires (0 );
271271 $ form ->setIsAnonymous (false );
272+ $ form ->setLastUpdated (time ());
272273
273274 $ this ->formMapper ->insert ($ form );
274275
@@ -315,6 +316,7 @@ public function cloneForm(int $id): DataResponse {
315316 $ formData = $ oldForm ->read ();
316317 unset($ formData ['id ' ]);
317318 $ formData ['created ' ] = time ();
319+ $ formData ['lastUpdated ' ] = time ();
318320 $ formData ['hash ' ] = $ this ->formsService ->generateFormHash ();
319321 // TRANSLATORS Appendix to the form Title of a duplicated/copied form.
320322 $ formData ['title ' ] .= ' - ' . $ this ->l10n ->t ('Copy ' );
@@ -384,9 +386,10 @@ public function updateForm(int $id, array $keyValuePairs): DataResponse {
384386 throw new OCSForbiddenException ();
385387 }
386388
387- // Don't allow to change params id, hash, ownerId, created
389+ // Don't allow to change params id, hash, ownerId, created, lastUpdated
388390 if (key_exists ('id ' , $ keyValuePairs ) || key_exists ('hash ' , $ keyValuePairs ) ||
389- key_exists ('ownerId ' , $ keyValuePairs ) || key_exists ('created ' , $ keyValuePairs )) {
391+ key_exists ('ownerId ' , $ keyValuePairs ) || key_exists ('created ' , $ keyValuePairs ) ||
392+ key_exists ('lastUpdated ' , $ keyValuePairs )) {
390393 $ this ->logger ->info ('Not allowed to update id, hash, ownerId or created ' );
391394 throw new OCSForbiddenException ();
392395 }
@@ -397,6 +400,7 @@ public function updateForm(int $id, array $keyValuePairs): DataResponse {
397400
398401 // Update changed Columns in Db.
399402 $ this ->formMapper ->update ($ form );
403+ $ this ->formsService ->setLastUpdatedTimestamp ($ id );
400404
401405 return new DataResponse ($ form ->getId ());
402406 }
@@ -501,6 +505,8 @@ public function newQuestion(int $formId, string $type, string $text = ''): DataR
501505 $ response = $ question ->read ();
502506 $ response ['options ' ] = [];
503507
508+ $ this ->formsService ->setLastUpdatedTimestamp ($ formId );
509+
504510 return new DataResponse ($ response );
505511 }
506512
@@ -594,6 +600,8 @@ public function reorderQuestions(int $formId, array $newOrder): DataResponse {
594600 ];
595601 }
596602
603+ $ this ->formsService ->setLastUpdatedTimestamp ($ formId );
604+
597605 return new DataResponse ($ response );
598606 }
599607
@@ -654,6 +662,8 @@ public function updateQuestion(int $id, array $keyValuePairs): DataResponse {
654662 // Update changed Columns in Db.
655663 $ this ->questionMapper ->update ($ question );
656664
665+ $ this ->formsService ->setLastUpdatedTimestamp ($ form ->getId ());
666+
657667 return new DataResponse ($ question ->getId ());
658668 }
659669
@@ -703,6 +713,8 @@ public function deleteQuestion(int $id): DataResponse {
703713 }
704714 }
705715
716+ $ this ->formsService ->setLastUpdatedTimestamp ($ form ->getId ());
717+
706718 return new DataResponse ($ id );
707719 }
708720
@@ -744,6 +756,8 @@ public function newOption(int $questionId, string $text): DataResponse {
744756
745757 $ option = $ this ->optionMapper ->insert ($ option );
746758
759+ $ this ->formsService ->setLastUpdatedTimestamp ($ form ->getId ());
760+
747761 return new DataResponse ($ option ->read ());
748762 }
749763
@@ -798,6 +812,8 @@ public function updateOption(int $id, array $keyValuePairs): DataResponse {
798812 // Update changed Columns in Db.
799813 $ this ->optionMapper ->update ($ option );
800814
815+ $ this ->formsService ->setLastUpdatedTimestamp ($ form ->getId ());
816+
801817 return new DataResponse ($ option ->getId ());
802818 }
803819
@@ -833,6 +849,8 @@ public function deleteOption(int $id): DataResponse {
833849
834850 $ this ->optionMapper ->delete ($ option );
835851
852+ $ this ->formsService ->setLastUpdatedTimestamp ($ form ->getId ());
853+
836854 return new DataResponse ($ id );
837855 }
838856
@@ -1013,6 +1031,8 @@ public function insertSubmission(int $formId, array $answers, string $shareHash
10131031 }
10141032 }
10151033
1034+ $ this ->formsService ->setLastUpdatedTimestamp ($ formId );
1035+
10161036 //Create Activity
10171037 $ this ->activityManager ->publishNewSubmission ($ form , $ submission ->getUserId ());
10181038
@@ -1051,6 +1071,8 @@ public function deleteSubmission(int $id): DataResponse {
10511071 // Delete submission (incl. Answers)
10521072 $ this ->submissionMapper ->deleteById ($ id );
10531073
1074+ $ this ->formsService ->setLastUpdatedTimestamp ($ form ->getId ());
1075+
10541076 return new DataResponse ($ id );
10551077 }
10561078
@@ -1085,6 +1107,8 @@ public function deleteAllSubmissions(int $formId): DataResponse {
10851107 // Delete all submissions (incl. Answers)
10861108 $ this ->submissionMapper ->deleteByForm ($ formId );
10871109
1110+ $ this ->formsService ->setLastUpdatedTimestamp ($ formId );
1111+
10881112 return new DataResponse ($ formId );
10891113 }
10901114
0 commit comments