File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747 $context . removeClass ( 'loading' ) ;
4848 } ,
4949 error : function ( response ) {
50- $context . prop ( 'disabled' , '' ) ;
51- $context . removeClass ( 'loading' ) ;
52- if ( response . responseJSON && response . responseJSON . ocs . data . error ) {
53- $context . siblings ( 'span.warning' )
54- . removeClass ( 'hidden' )
55- . html ( response . responseJSON . ocs . data . error ) ;
50+ if ( response . status !== 429 ) {
51+ $context . prop ( 'disabled' , '' ) ;
5652 }
53+
54+ $context . removeClass ( 'loading' ) ;
55+
56+ const errorMessage = response . status === 429
57+ ? t ( 'data_request' , 'Already requested, please try again later.' )
58+ : ( response . responseJSON ?. ocs ?. data ?. error || t ( 'data_request' , 'Request failed' ) ) ;
59+
60+ $context . siblings ( 'span.warning' )
61+ . removeClass ( 'hidden' )
62+ . html ( errorMessage ) ;
5763 }
5864 } ) ;
5965 }
Original file line number Diff line number Diff line change 1010use OCA \DataRequest \Exceptions \HintedRuntime ;
1111use OCA \DataRequest \Services \Request ;
1212use OCP \AppFramework \Http ;
13+ use OCP \AppFramework \Http \Attribute \UserRateLimit ;
1314use OCP \AppFramework \Http \DataResponse ;
1415use OCP \AppFramework \OCSController ;
1516use OCP \IRequest ;
@@ -33,6 +34,7 @@ public function __construct(
3334 * @NoAdminRequired
3435 * @PasswordConfirmationRequired
3536 */
37+ #[UserRateLimit(limit: 1 , period: 3600 )]
3638 public function export (): DataResponse {
3739 return $ this ->processRequest (function (): void {
3840 $ this ->dataRequest ->sendExportRequest ();
@@ -43,6 +45,7 @@ public function export(): DataResponse {
4345 * @NoAdminRequired
4446 * @PasswordConfirmationRequired
4547 */
48+ #[UserRateLimit(limit: 1 , period: 3600 )]
4649 public function deletion (): DataResponse {
4750 return $ this ->processRequest (function (): void {
4851 $ this ->dataRequest ->sendDeleteRequest ();
You can’t perform that action at this time.
0 commit comments