r7432 - dumbhippo/trunk/server/src/com/dumbhippo/server/blocks



Author: otaylor
Date: 2008-04-17 17:09:55 -0500 (Thu, 17 Apr 2008)
New Revision: 7432

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/MusicPersonBlockHandlerBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/PostBlockHandlerBean.java
Log:
- Fix notification/invalidation of MusicPersonBlockDMOchatId, making music blocks
  work properly in the data model stacker
- Fix some missing invalidations from BlockDMO.public


Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/MusicPersonBlockHandlerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/MusicPersonBlockHandlerBean.java	2008-04-17 18:19:00 UTC (rev 7431)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/MusicPersonBlockHandlerBean.java	2008-04-17 22:09:55 UTC (rev 7432)
@@ -109,7 +109,10 @@
 			// happens if someone has never played anything
 			publicBlock = musicSystem.hasTrackHistory(AnonymousViewpoint.getInstance(Site.NONE), user);
 		}
-		block.setPublicBlock(publicBlock);
+		if (block.isPublicBlock() != publicBlock) {
+			block.setPublicBlock(publicBlock);
+			DataService.currentSessionRW().changed(BlockDMO.class, new BlockDMOKey(block), "public");
+		}
 	}
 
 	private void updatePublicFlag(Account account, boolean knownToHaveTracks) {
@@ -146,7 +149,10 @@
 	public void onTrackPlayed(User user, Track track, Date when) {
 		Block block = stacker.stack(getKey(user), when.getTime(), user, false, StackReason.BLOCK_UPDATE);
 		
-		DataService.currentSessionRW().feedChanged(BlockDMO.class, new BlockDMOKey(block), "tracks", when.getTime());
+		BlockDMOKey blockKey = new BlockDMOKey(block);
+		DataService.currentSessionRW().feedChanged(BlockDMO.class, blockKey, "tracks", when.getTime());
+		// The chatId is the track history ID of the most-recently played track for the user
+		DataService.currentSessionRW().changed(BlockDMO.class, blockKey, "chatId");
 
 		// if we weren't public we might be now. Playing a track won't 
 		// ever un-public us though.

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/PostBlockHandlerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/PostBlockHandlerBean.java	2008-04-17 18:19:00 UTC (rev 7431)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/blocks/PostBlockHandlerBean.java	2008-04-17 22:09:55 UTC (rev 7432)
@@ -25,6 +25,9 @@
 import com.dumbhippo.persistence.UserBlockData;
 import com.dumbhippo.server.NotFoundException;
 import com.dumbhippo.server.PostingBoard;
+import com.dumbhippo.server.dm.BlockDMO;
+import com.dumbhippo.server.dm.BlockDMOKey;
+import com.dumbhippo.server.dm.DataService;
 import com.dumbhippo.server.util.EJBUtil;
 import com.dumbhippo.server.views.ChatMessageView;
 import com.dumbhippo.server.views.PostView;
@@ -126,6 +129,7 @@
 			return;
 		}
 		block.setPublicBlock(post.isPublic() && !post.isDisabled());
+		DataService.currentSessionRW().changed(BlockDMO.class, new BlockDMOKey(block), "public");	
 	}
 
 	public void onPostClicked(Post post, User user, long clickedTime) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]