mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-24 22:14:38 +08:00
?admin use JavaScript Optional chaining
This commit is contained in:
parent
17fa031064
commit
1a130d0be3
4 changed files with 9 additions and 9 deletions
|
@ -57,7 +57,7 @@ export class AdminSettingsAbout /*extends AbstractViewSettings*/ {
|
|||
this.coreChecking(true);
|
||||
Remote.request('AdminUpdateInfo', (iError, data) => {
|
||||
this.coreChecking(false);
|
||||
if (!iError && data && data.Result) {
|
||||
if (!iError && data?.Result) {
|
||||
this.coreReal(true);
|
||||
this.coreUpdatable(!!data.Result.Updatable);
|
||||
this.coreWarning(!!data.Result.Warning);
|
||||
|
@ -79,7 +79,7 @@ export class AdminSettingsAbout /*extends AbstractViewSettings*/ {
|
|||
this.coreUpdating(false);
|
||||
this.coreVersion('');
|
||||
this.coreVersionCompare(-2);
|
||||
if (!iError && data && data.Result) {
|
||||
if (!iError && data?.Result) {
|
||||
this.coreReal(true);
|
||||
window.location.reload();
|
||||
} else {
|
||||
|
|
|
@ -85,7 +85,7 @@ export class AdminSettingsContacts extends AbstractViewSettings {
|
|||
this.testContactsSuccess(true);
|
||||
} else {
|
||||
this.testContactsError(true);
|
||||
if (data && data.Result) {
|
||||
if (data?.Result) {
|
||||
this.testContactsErrorMessage(data.Result.Message || '');
|
||||
} else {
|
||||
this.testContactsErrorMessage('');
|
||||
|
|
|
@ -68,7 +68,7 @@ export class AdminSettingsGeneral extends AbstractViewSettings {
|
|||
|
||||
this.uploadData = SettingsGet('PhpUploadSizes');
|
||||
this.uploadDataDesc =
|
||||
this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size)
|
||||
(this.uploadData?.upload_max_filesize || this.uploadData?.post_max_size)
|
||||
? [
|
||||
this.uploadData.upload_max_filesize
|
||||
? 'upload_max_filesize = ' + this.uploadData.upload_max_filesize + '; '
|
||||
|
|
|
@ -24,9 +24,9 @@ export class AdminSettingsPackages extends AbstractViewSettings {
|
|||
this.packages = PackageAdminStore;
|
||||
|
||||
addComputablesTo(this, {
|
||||
packagesCurrent: () => PackageAdminStore().filter(item => item && item.installed && !item.canBeUpdated),
|
||||
packagesUpdate: () => PackageAdminStore().filter(item => item && item.installed && item.canBeUpdated),
|
||||
packagesAvailable: () => PackageAdminStore().filter(item => item && !item.installed),
|
||||
packagesCurrent: () => PackageAdminStore().filter(item => item?.installed && !item.canBeUpdated),
|
||||
packagesUpdate: () => PackageAdminStore().filter(item => item?.installed && item.canBeUpdated),
|
||||
packagesAvailable: () => PackageAdminStore().filter(item => !item?.installed),
|
||||
|
||||
visibility: () => (PackageAdminStore.loading() ? 'visible' : 'hidden')
|
||||
});
|
||||
|
@ -59,7 +59,7 @@ export class AdminSettingsPackages extends AbstractViewSettings {
|
|||
requestHelper(packageToRequest, install) {
|
||||
return (iError, data) => {
|
||||
PackageAdminStore.forEach(item => {
|
||||
if (item && packageToRequest && item.loading && item.loading() && packageToRequest.file === item.file) {
|
||||
if (packageToRequest && item?.loading() && packageToRequest.file === item.file) {
|
||||
packageToRequest.loading(false);
|
||||
item.loading(false);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ export class AdminSettingsPackages extends AbstractViewSettings {
|
|||
if (iError) {
|
||||
plugin.enabled(disable);
|
||||
this.packagesError(
|
||||
(Notification.UnsupportedPluginPackage === iError && data && data.ErrorMessage)
|
||||
(Notification.UnsupportedPluginPackage === iError && data?.ErrorMessage)
|
||||
? data.ErrorMessage
|
||||
: getNotification(iError)
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue