r7103 - in dumbhippo/trunk/server/src/com/dumbhippo: server server/impl web/servlets



Author: marinaz
Date: 2007-12-20 12:01:59 -0600 (Thu, 20 Dec 2007)
New Revision: 7103

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/FacebookTracker.java
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
Log:
Do not reset applicationEnabled to false if the user logged in to Facebook from Mugshot.

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/FacebookTracker.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/FacebookTracker.java	2007-12-20 15:30:27 UTC (rev 7102)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/FacebookTracker.java	2007-12-20 18:01:59 UTC (rev 7103)
@@ -14,9 +14,9 @@
 
 	public void updateOrCreateFacebookAccount(UserViewpoint viewpoint, String facebookAuthToken) throws FacebookSystemException;	
 	
-	public void updateOrCreateFacebookAccount(UserViewpoint viewpoint, String sessionKey, String facebookUserId, boolean applicationEnabled) throws FacebookSystemException;
+	public void updateOrCreateFacebookAccount(UserViewpoint viewpoint, String sessionKey, String facebookUserId, Boolean applicationEnabled) throws FacebookSystemException;
 
-	public User createNewUserWithFacebookAccount(String sessionKey, String facebookUserId, boolean applicationEnabled) throws FacebookSystemException;
+	public User createNewUserWithFacebookAccount(String sessionKey, String facebookUserId, Boolean applicationEnabled) throws FacebookSystemException;
 
 	public FacebookAccount getFacebookAccount(String facebookUserId);
 	

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java	2007-12-20 15:30:27 UTC (rev 7102)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java	2007-12-20 18:01:59 UTC (rev 7103)
@@ -119,10 +119,10 @@
 		if (sessionKey == null || facebookUserId == null)
 			return;
 		
-		updateOrCreateFacebookAccount(viewpoint, sessionKey, facebookUserId, false);
+		updateOrCreateFacebookAccount(viewpoint, sessionKey, facebookUserId, null);
 	}
 
-	public void updateOrCreateFacebookAccount(UserViewpoint viewpoint, String sessionKey, String facebookUserId, boolean applicationEnabled) throws FacebookSystemException {
+	public void updateOrCreateFacebookAccount(UserViewpoint viewpoint, String sessionKey, String facebookUserId, Boolean applicationEnabled) throws FacebookSystemException {
 		ExternalAccount externalAccount = externalAccounts.getOrCreateExternalAccount(viewpoint, ExternalAccountType.FACEBOOK);
 		
 		FacebookAccount facebookAccount;
@@ -214,7 +214,9 @@
 	    facebookAccount.setSessionKey(sessionKey);
 	    if (sessionKey != null)
 		    facebookAccount.setSessionKeyValid(true);	
-	    facebookAccount.setApplicationEnabled(applicationEnabled);
+	    if (applicationEnabled != null)
+	        facebookAccount.setApplicationEnabled(applicationEnabled);
+	    
 		// make sure the sentiment is LOVE; there is currently no way to unset it from the user interface,
 		// but we should allow changing the sentiment to HATE or at least INDIFFERENT in the future
 		externalAccounts.setSentiment(externalAccount, Sentiment.LOVE);
@@ -223,7 +225,10 @@
 		if (loginStatusEvent != null)  
 		    notifier.onFacebookEvent(facebookAccount.getExternalAccount().getAccount().getOwner(), loginStatusEvent);
 		
-		if (applicationEnabled) {
+		// even if applicationEnabled is null, which means the user logged in to Facebook on the Mugshot account
+		// or person page, we might as well update the FBML in case they added new accounts
+		// TODO: call updateFbmlForUser when new external accounts are added
+		if (facebookAccount.isApplicationEnabled()) {
 			final User user = viewpoint.getViewer();
 		    TxUtils.runOnCommit(new Runnable() {
 			    public void run() {
@@ -233,7 +238,7 @@
 		}
 	}
 	
-	public User createNewUserWithFacebookAccount(String sessionKey, String facebookUserId, boolean applicationEnabled) throws FacebookSystemException {
+	public User createNewUserWithFacebookAccount(String sessionKey, String facebookUserId, Boolean applicationEnabled) throws FacebookSystemException {
 		// the resource might have already existed, but not claimed by anyone
 		FacebookResource res;
 		try {
@@ -614,11 +619,11 @@
 		fbmlSb.append("</fb:wide>");	
 		
 		fbmlSb.append("<fb:narrow>");	
-		for (int i=1; i<=23; i++ ) {
+		for (int i=1; i<=25; i++ ) {
 		    fbmlSb.append("&nbsp;");
 		}
 		fbmlSb.append("</fb:narrow>");
-		
+	
 		fbmlSb.append("<fb:fbml version='1.1'><fb:visible-to-owner><a href='http://apps.facebook.com/mugshot' style='float:right;'>Edit Accounts</a>" +
 		              "</fb:visible-to-owner></fb:fbml></fb:subtitle>");
 

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2007-12-20 15:30:27 UTC (rev 7102)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2007-12-20 18:01:59 UTC (rev 7103)
@@ -174,7 +174,7 @@
 		XmlBuilder xml = new XmlBuilder();	
 		String baseUrl = config.getBaseUrlMugshot().toExternalForm();
 
-        xml.appendTextNode("fb:header", "Musgshot");
+        xml.appendTextNode("fb:header", "Mugshot");
         xml.appendTextNode("div", "Mugshot allows you and your friends to see your activity from lots of other sites on the internet in a single place in your profile.",
                            "style", "margin-left:22px;margin-bottom:10px;font-weight:bold;");
 		if (user != null && errorMessage == null) {



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