Skip to content
Snippets Groups Projects
Commit 7528a9a4 authored by hg's avatar hg
Browse files

OO-3272: Portrait and logo should only be deleted if save button is clicked

parent 7d8f7cba
No related branches found
No related tags found
No related merge requests found
......@@ -98,6 +98,8 @@ public class ProfileFormController extends FormBasicController {
private final boolean isAdministrativeUser;
private final List<UserPropertyHandler> userPropertyHandlers;
private boolean portraitDeleted = false;
private boolean logoDeleted = false;
private boolean emailChanged = false;
private String changedEmail;
private String currentEmail;
......@@ -386,19 +388,12 @@ public class ProfileFormController extends FormBasicController {
if (source == portraitUpload) {
if(event instanceof FileElementEvent) {
if(FileElementEvent.DELETE.equals(event.getCommand())) {
File img = dps.getLargestPortrait(identityToModify.getName());
portraitDeleted = true;
portraitUpload.setInitialFile(null);
if(portraitUpload.getUploadFile() != null) {
portraitUpload.reset();
if(img != null) {
portraitUpload.setInitialFile(img);
}
} else if(img != null) {
dps.deletePortrait(identityToModify);
portraitUpload.setInitialFile(null);
notifyPortraitChanged();
}
flc.setDirty(true);
}
} else if (portraitUpload.isUploadSuccess()) {
flc.setDirty(true);
......@@ -406,19 +401,12 @@ public class ProfileFormController extends FormBasicController {
} else if (source == logoUpload) {
if(event instanceof FileElementEvent) {
if(FileElementEvent.DELETE.equals(event.getCommand())) {
File img = dps.getLargestLogo(identityToModify.getName());
logoDeleted = true;
logoUpload.setInitialFile(null);
if(logoUpload.getUploadFile() != null) {
logoUpload.reset();
if(img != null) {
logoUpload.setInitialFile(img);
}
} else if(img != null) {
dps.deleteLogo(identityToModify);
logoUpload.setInitialFile(null);
notifyPortraitChanged();
}
flc.setDirty(true);
}
} else if (logoUpload.isUploadSuccess()) {
flc.setDirty(true);
......@@ -445,6 +433,14 @@ public class ProfileFormController extends FormBasicController {
}
}
if (portraitDeleted) {
File img = dps.getLargestPortrait(identityToModify.getName());
if(img != null) {
dps.deletePortrait(identityToModify);
notifyPortraitChanged();
}
}
File uploadedImage = portraitUpload.getUploadFile();
String uploadedFilename = portraitUpload.getUploadFileName();
if(uploadedImage != null) {
......@@ -452,6 +448,14 @@ public class ProfileFormController extends FormBasicController {
notifyPortraitChanged();
}
if (logoDeleted) {
File img = dps.getLargestLogo(identityToModify.getName());
if(img != null) {
dps.deleteLogo(identityToModify);
notifyPortraitChanged();
}
}
if(logoUpload != null) {
File uploadedLogo = logoUpload.getUploadFile();
String uploadedLogoname = logoUpload.getUploadFileName();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment