use of teammates.common.util.StatusMessage in project teammates by TEAMMATES.
the class StudentProfilePictureUploadAction method validateProfilePicture.
private BlobInfo validateProfilePicture(BlobInfo profilePic) {
if (profilePic.getSize() > Const.SystemParams.MAX_PROFILE_PIC_SIZE) {
deletePicture(profilePic.getBlobKey());
isError = true;
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_PROFILE_PIC_TOO_LARGE, StatusMessageColor.DANGER));
return null;
} else if (!profilePic.getContentType().contains("image/")) {
deletePicture(profilePic.getBlobKey());
isError = true;
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_PROFILE_NOT_A_PICTURE, StatusMessageColor.DANGER));
return null;
}
return profilePic;
}
Aggregations