Skip to content

Commit

Permalink
#1286 Notify attendees about events cancelation
Browse files Browse the repository at this point in the history
  • Loading branch information
car031 committed Oct 10, 2024
1 parent 9923f59 commit 9d2e65f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void schedule(AbstractJob job, Map<String, Object> dictionary, Map<Object
JobKey jobKey = JobKey.jobKey(job.getName(), job.getGroup());
JobDetail jobDetail = scheduler.getJobDetail(jobKey);
if (jobDetail != null) {
// Delete the job and all it's triggers that may altrady exist
// Delete the job and all it's triggers that may already exist
scheduler.deleteJob(jobKey);
}

Expand All @@ -118,7 +118,6 @@ private Trigger prepareTrigger(AbstractJob job, Object triggerSpec, Map<Object,

if (triggerSpec instanceof Date dateSpec) {
// The job must be fired on a specific data

SimpleScheduleBuilder schedule = SimpleScheduleBuilder.simpleSchedule();
if (MISSFIRE_RUNNOW.equals(getMissfireInstruction(job.getGroup())))
schedule = schedule.withMisfireHandlingInstructionFireNow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,8 @@ private void saveAttendees() {
*/
private void onDelete() {
GUIUser currentUser = Session.get().getUser();
if (currentUser.getId() != calendarEvent.getOrganizerId() && !currentUser.isMemberOf(Constants.GROUP_ADMIN)) {
if (currentUser.getId() != calendarEvent.getOrganizerId() && !currentUser.isMemberOf(Constants.GROUP_ADMIN))
return;
}

LD.ask(I18N.message("delevent"), I18N.message("deleventconfirm"), confirmToDelete -> {
if (Boolean.FALSE.equals(confirmToDelete))
Expand All @@ -892,41 +891,35 @@ private void onDelete() {
if (calendarEvent.getParentId() != null) {
LD.ask(I18N.message("delevent"), I18N.message("douwantdeletealloccurrences"), answer -> {
Long id = Boolean.TRUE.equals(answer) ? calendarEvent.getParentId() : calendarEvent.getId();
LD.contactingServer();
CalendarService.Instance.get().deleteEvent(id, new AsyncCallback<>() {
@Override
public void onFailure(Throwable caught) {
GuiLog.serverError(caught);
}

@Override
public void onSuccess(Void arg) {
LD.clearPrompt();
destroy();
}
});
deleteEvent(id);
});
} else {
LD.contactingServer();
CalendarService.Instance.get().deleteEvent(calendarEvent.getId(), new AsyncCallback<>() {

@Override
public void onFailure(Throwable caught) {
GuiLog.serverError(caught);
}

@Override
public void onSuccess(Void arg) {
LD.clearPrompt();
destroy();
if (onChangedCallback != null)
onChangedCallback.onSuccess(arg);
}
});
deleteEvent(calendarEvent.getId());
}
});
}

private void deleteEvent(Long id) {
LD.ask(I18N.message("delevent"), I18N.message("askalertcancelation"), answer -> {
LD.contactingServer();
CalendarService.Instance.get().deleteEvent(id, Boolean.TRUE.equals(answer), new AsyncCallback<>() {
@Override
public void onFailure(Throwable caught) {
GuiLog.serverError(caught);
}

@Override
public void onSuccess(Void arg) {
LD.clearPrompt();
destroy();
if (onChangedCallback != null)
onChangedCallback.onSuccess(arg);
}
});
});

}

private void addAttendee(final ListGrid list, String id, String name, String email) {
// Check if the selected user is already present in the list
ListGridRecord[] records = list.getRecords();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ public interface CalendarService extends RemoteService {
* occurrences will be deleted too
*
* @param eventId identifier of the event
* @param alertCancelation flat to alert attendees about the cancelation
*
* @throws ServerException an error happened in the server application
*/
public void deleteEvent(long eventId) throws ServerException;
public void deleteEvent(long eventId, boolean alertCancelation) throws ServerException;

/**
* Counts the number of events that start from now until a given date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface CalendarServiceAsync {

void getEvent(long eventId, AsyncCallback<GUICalendarEvent> callback);

void deleteEvent(long eventId, AsyncCallback<Void> callback);
void deleteEvent(long eventId, boolean alertCancelation, AsyncCallback<Void> callback);

void countUserEvents(String username, Date end, AsyncCallback<Integer> callback);

Expand Down
5 changes: 4 additions & 1 deletion logicaldoc-i18n/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2615,4 +2615,7 @@ thisdocsecurityparent = This document does not define any security policy so <u>
onlyoffice = OnlyOffice
allowclientid = Allow use of Client ID to hook session
editwithonlyoffice = Edit with OnlyOffice
notifyicalendar = Send iCalendar notifications
notifyicalendar = Send iCalendar notifications
eventhasbeencanceled = The event has been canceled
askalertcancelation = Do you want to notify attendees about this cancelation ?
canceledevent = Canceled event

0 comments on commit 9d2e65f

Please sign in to comment.