This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new 00fd257  [OPENMEETINGS-2480] appointment invitation links are fixed
00fd257 is described below

commit 00fd25771ba428035eaea83645f5d8c5386143ab
Author: Maxim Solodovnik <solomax...@gmail.com>
AuthorDate: Thu Oct 15 18:48:08 2020 +0700

    [OPENMEETINGS-2480] appointment invitation links are fixed
---
 .../db/dao/calendar/AppointmentDao.java             | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
index 10c91dc..474df5d 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
@@ -99,11 +99,19 @@ public class AppointmentDao implements 
IDataProviderDao<Appointment>{
                        
r.setCapacity(cfgDao.getLong(CONFIG_CALENDAR_ROOM_CAPACITY, 50L));
                }
                a.setRoom(roomDao.update(r, userId));
+               final boolean newApp = a.getId() == null;
+               if (newApp) {
+                       a.setInserted(new Date());
+                       em.persist(a);
+               } else {
+                       a.setUpdated(new Date());
+                       a = em.merge(a);
+               }
                if (sendmails) {
-                       Set<Long> mmIds = a.getId() == null ? new HashSet<>()
+                       Set<Long> mmIds = newApp ? new HashSet<>()
                                        : 
meetingMemberDao.getMeetingMemberIdsByAppointment(a.getId());
                        // update meeting members
-                       Appointment a0 = a.getId() == null ? null : 
get(a.getId());
+                       Appointment a0 = newApp ? null : get(a.getId());
                        boolean sendMail = a0 == null || 
!a0.getTitle().equals(a.getTitle()) ||
                                        !(a0.getDescription() != null ? 
a0.getDescription().equals(a.getDescription()) : true) ||
                                        !(a0.getLocation() != null ? 
a0.getLocation().equals(a.getLocation()) : true) ||
@@ -126,7 +134,7 @@ public class AppointmentDao implements 
IDataProviderDao<Appointment>{
                        //notify owner
                        MeetingMember owner = new MeetingMember();
                        owner.setUser(a.getOwner());
-                       if (a.getId() == null) {
+                       if (newApp) {
                                invitationManager.processInvitation(a, owner, 
MessageType.CREATE);
                        } else if (a.isDeleted()) {
                                invitationManager.processInvitation(a, owner, 
MessageType.CANCEL);
@@ -134,13 +142,6 @@ public class AppointmentDao implements 
IDataProviderDao<Appointment>{
                                invitationManager.processInvitation(a, owner, 
MessageType.UPDATE, sendMail);
                        }
                }
-               if (a.getId() == null) {
-                       a.setInserted(new Date());
-                       em.persist(a);
-               } else {
-                       a.setUpdated(new Date());
-                       a = em.merge(a);
-               }
                return a;
        }
 

Reply via email to