|
135 | 135 | !!response.error.length |
136 | 136 | ); |
137 | 137 |
|
138 | | - const message = response.error |
139 | | - ? t(OCA.Onlyoffice.AppName, "Error when trying to connect") + |
140 | | - " (" + |
141 | | - response.error + |
142 | | - ")" |
143 | | - : t( |
| 138 | + if (!response.error && response.secret === null) { |
| 139 | + OC.dialogs.info( |
| 140 | + t( |
144 | 141 | OCA.Onlyoffice.AppName, |
145 | | - "Settings have been successfully updated" |
146 | | - ); |
147 | | - |
148 | | - const versionMessage = response.version |
149 | | - ? " (" + |
150 | | - t(OCA.Onlyoffice.AppName, "version") + |
151 | | - " " + |
152 | | - response.version + |
153 | | - ")" |
154 | | - : ""; |
155 | | - |
156 | | - OC.Notification.show(message + versionMessage, { |
157 | | - type: response.error ? "error" : null, |
158 | | - timeout: 3, |
159 | | - }); |
| 142 | + "Server settings have been successfully updated" |
| 143 | + ) + |
| 144 | + ". " + |
| 145 | + t( |
| 146 | + OCA.Onlyoffice.AppName, |
| 147 | + "To ensure the security of important parameters in ONLYOFFICE Docs requests, please set a Secret Key on the Settings page." |
| 148 | + ), |
| 149 | + t(OCA.Onlyoffice.AppName, "Info") |
| 150 | + ); |
| 151 | + } else { |
| 152 | + const message = response.error |
| 153 | + ? t(OCA.Onlyoffice.AppName, "Error when trying to connect") + |
| 154 | + " (" + |
| 155 | + response.error + |
| 156 | + ")" |
| 157 | + : t( |
| 158 | + OCA.Onlyoffice.AppName, |
| 159 | + "Server settings have been successfully updated" |
| 160 | + ); |
| 161 | + |
| 162 | + const versionMessage = response.version |
| 163 | + ? " (" + |
| 164 | + t(OCA.Onlyoffice.AppName, "version") + |
| 165 | + " " + |
| 166 | + response.version + |
| 167 | + ")" |
| 168 | + : ""; |
| 169 | + |
| 170 | + OC.Notification.show(message + versionMessage, { |
| 171 | + type: response.error ? "error" : null, |
| 172 | + timeout: 3, |
| 173 | + }); |
| 174 | + } |
160 | 175 | } else { |
161 | 176 | $(".section-onlyoffice-2").addClass("onlyoffice-hide"); |
162 | 177 | } |
|
235 | 250 | if (response) { |
236 | 251 | const message = t( |
237 | 252 | OCA.Onlyoffice.AppName, |
238 | | - "Settings have been successfully updated" |
| 253 | + "Common settings have been successfully updated" |
239 | 254 | ); |
240 | 255 | OC.Notification.show(message, { |
241 | 256 | timeout: 3, |
|
269 | 284 | if (response) { |
270 | 285 | const message = t( |
271 | 286 | OCA.Onlyoffice.AppName, |
272 | | - "Settings have been successfully updated" |
| 287 | + "Security settings have been successfully updated" |
273 | 288 | ); |
274 | 289 | OC.Notification.show(message, { |
275 | 290 | timeout: 3, |
|
295 | 310 | }); |
296 | 311 |
|
297 | 312 | $("#onlyofficeClearVersionHistory").click(function () { |
298 | | - $(".section-onlyoffice").addClass("icon-loading"); |
299 | | - |
300 | | - $.ajax({ |
301 | | - method: "DELETE", |
302 | | - url: OC.generateUrl( |
303 | | - "apps/" + OCA.Onlyoffice.AppName + "/ajax/settings/history" |
304 | | - ), |
305 | | - success: function onSuccess(response) { |
306 | | - $(".section-onlyoffice").removeClass("icon-loading"); |
307 | | - if (response) { |
308 | | - const message = t( |
309 | | - OCA.Onlyoffice.AppName, |
310 | | - "All history successfully deleted" |
311 | | - ); |
312 | | - OC.Notification.show(message, { |
313 | | - timeout: 3, |
314 | | - }); |
| 313 | + OC.dialogs.confirm( |
| 314 | + t(OCA.Onlyoffice.AppName, 'Are you sure you want to clear metadata?'), |
| 315 | + t(OCA.Onlyoffice.AppName, 'Confirm metadata removal'), |
| 316 | + (clicked) => { |
| 317 | + if (!clicked) { |
| 318 | + return |
315 | 319 | } |
| 320 | + |
| 321 | + $(".section-onlyoffice").addClass("icon-loading"); |
| 322 | + |
| 323 | + $.ajax({ |
| 324 | + method: "DELETE", |
| 325 | + url: OC.generateUrl( |
| 326 | + "apps/" + OCA.Onlyoffice.AppName + "/ajax/settings/history" |
| 327 | + ), |
| 328 | + success: function onSuccess(response) { |
| 329 | + $(".section-onlyoffice").removeClass("icon-loading"); |
| 330 | + if (response) { |
| 331 | + const message = t( |
| 332 | + OCA.Onlyoffice.AppName, |
| 333 | + "All history successfully deleted" |
| 334 | + ); |
| 335 | + OC.Notification.show(message, { |
| 336 | + timeout: 3, |
| 337 | + }); |
| 338 | + } |
| 339 | + }, |
| 340 | + }); |
316 | 341 | }, |
317 | | - }); |
| 342 | + ) |
318 | 343 | }); |
319 | 344 |
|
320 | 345 | $("#onlyofficeAddTemplate").change(function () { |
|
0 commit comments