Skip to content
Browse files

SAK-21174 Announcement Emails Are Blank

  • Loading branch information...
1 parent 738422d commit 23e8f76f6079e15f08b791a5da1429299b337baf holladay@longsight.com committed
View
5 announcement-api/api/src/java/org/sakaiproject/announcement/api/AnnouncementService.java
@@ -154,4 +154,9 @@ public AnnouncementChannelEdit addAnnouncementChannel(String ref) throws IdUsedE
*/
public boolean isMessageViewable(AnnouncementMessage message);
+ /**
+ * clears the message cache for this channel
+ * @param channelRef
+ */
+ public void clearMessagesCache(String channelRef);
}
View
7 announcement-api/api/src/java/org/sakaiproject/announcement/cover/AnnouncementService.java
@@ -331,4 +331,11 @@ public static boolean isMessageViewable(AnnouncementMessage param0)
return service.isMessageViewable(param0);
}
+
+ public static void clearMessagesCache(String channelRef){
+ org.sakaiproject.announcement.api.AnnouncementService service = getInstance();
+ if (service != null){
+ service.clearMessagesCache(channelRef);
+ }
+ }
}
View
3 ...cement-impl/impl/src/java/org/sakaiproject/announcement/impl/BaseAnnouncementService.java
@@ -1785,4 +1785,7 @@ public void transferCopyEntities(String fromContext, String toContext, List ids,
return null;
}
+ public void clearMessagesCache(String channelRef){
+ m_threadLocalManager.set(channelRef + ".msgs", null);
+ }
}
View
3 announcement-tool/tool/src/java/org/sakaiproject/announcement/tool/AnnouncementAction.java
@@ -2888,6 +2888,9 @@ else if ("n".equals(notification))
// we should be modifying the database records for 5-12 and decrementing their message order
int oldMessageOrder = header.getMessage_order();
List<Message> channelMessages = channel.getMessages(null, true); // ascending order
+ //need to clear the message cache otherwise channel.getMessages stores the old (unsaved) message in cache
+ AnnouncementService.clearMessagesCache(channel.getReference());
+
// sort the messages by current sort order
SortedIterator messSorted = new SortedIterator(channelMessages.iterator(), new AnnouncementComparator(getCurrentOrder(), true));

0 comments on commit 23e8f76

Please sign in to comment.
Something went wrong with that request. Please try again.