Revision 2085c699
Added by Andreas Kohlbecker about 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkingsetPresenter.java | ||
---|---|---|
214 | 214 |
RegistrationDTO regDto = workingset.getRegistrationDTO(registrationId).get(); |
215 | 215 |
try { |
216 | 216 |
int messageCount = messageService.countActiveMessagesFor(regDto.registration(), user); |
217 |
messageButton.setEnabled(UserHelper.fromSession().userIsRegistrationCurator() || messageCount > 0); |
|
218 |
if(messageCount > 0){ |
|
217 |
|
|
218 |
boolean activeMessages = messageCount > 0; |
|
219 |
boolean currentUserIsSubmitter = regDto.getSubmitterUserName().equals(UserHelper.fromSession().userName()); |
|
220 |
boolean currentUserIsCurator = UserHelper.fromSession().userIsRegistrationCurator(); |
|
221 |
messageButton.setEnabled(false); |
|
222 |
if(currentUserIsCurator){ |
|
223 |
if(currentUserIsSubmitter){ |
|
224 |
messageButton.setDescription("No point sending messages to your self."); |
|
225 |
} else { |
|
226 |
messageButton.setEnabled(true); |
|
227 |
messageButton.setDescription("Open the messages dialog"); |
|
228 |
} |
|
229 |
} |
|
230 |
if(activeMessages){ |
|
231 |
messageButton.setEnabled(true); |
|
219 | 232 |
messageButton.addStyleName(EditValoTheme.BUTTON_HIGHLITE); |
233 |
messageButton.setDescription("There are active messages for you!"); |
|
220 | 234 |
} |
221 | 235 |
} catch (ExternalServiceException e) { |
222 | 236 |
messageButton.setComponentError(new SystemError(e.getMessage(), e)); |
Also available in: Unified diff
ref #7269 manaing enabled state of messages button and adding description text