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



Author: marinaz
Date: 2008-03-03 16:52:17 -0600 (Mon, 03 Mar 2008)
New Revision: 7348

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookSystemBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
Log:
Fix up the Facebook user profile url link.

Make sure we update ExternalAccount field of FacebookAccount when the association changes.

Provide better feedback on the Mugshot application page if we don't know the Mugshot user 
associted with the page visitor. 

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookSystemBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookSystemBean.java	2008-03-03 20:37:01 UTC (rev 7347)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookSystemBean.java	2008-03-03 22:52:17 UTC (rev 7348)
@@ -167,7 +167,7 @@
 	public String getProfileLink(ExternalAccount externalAccount) {
 		try {
 		    FacebookAccount facebookAccount = lookupFacebookAccount(externalAccount);
-		    return "http://www.facebook.com/profile.php?uid="; 
+		    return "http://www.facebook.com/profile.php?id="; 
 		           + facebookAccount.getFacebookUserId() + "&api_key=" + getApiKey();
 		} catch (NotFoundException e) {
 			throw new RuntimeException("An ExternalAccount passed to getProfileLink() was not associated with a valid FacebookAccount.", e);

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java	2008-03-03 20:37:01 UTC (rev 7347)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java	2008-03-03 22:52:17 UTC (rev 7348)
@@ -167,7 +167,8 @@
 							    em.remove(ac);
 							    em.flush();
 							    identitySpider.addVerifiedOwnershipClaim(viewpoint.getViewer(), res);
-							    externalAccount.setExtra(Long.toString(facebookAccount.getId()));		
+							    externalAccount.setExtra(Long.toString(facebookAccount.getId()));	
+							    facebookAccount.setExternalAccount(externalAccount); 
 							} catch (NotFoundException e) {
 								throw new RuntimeException("We expected to find a Facebook external account for user " + ac.getOwner() + ", but we didn't!");
 							}

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2008-03-03 20:37:01 UTC (rev 7347)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java	2008-03-03 22:52:17 UTC (rev 7348)
@@ -517,11 +517,22 @@
 		    	xml.closeElement();
 	        }
 		} else {
-			// TODO: verify that we didn't get the user information from Facebook, otherwise
-			// log an error
 			xml.openElement("fb:explanation");
-			xml.appendTextNode("fb:message", "Log in to Facebook first");			
-			xml.append("You need to be logged in to Facebook to use the Mugshot application.");
+            if (facebookParams.get(FacebookParam.ADDED.toString()) != null && facebookParams.get(FacebookParam.ADDED.toString()).toString().equals("0") 
+                && facebookParams.get(FacebookParam.USER.toString()) != null) {
+            	// the user is logged in, but that don't have the Mugshot application added
+    			xml.appendTextNode("fb:message", "Add Mugshot application first");			
+			    xml.append("You need to have Mugshot application added on Facebook in order to use it. ");
+		        xml.appendTextNode("a", "Add Mugshot application!", 
+     		           "href", "http://www.facebook.com/add.php?api_key="; + apiKey);		
+		    } else if (facebookParams.get(FacebookParam.USER.toString()) == null) {
+			    xml.appendTextNode("fb:message", "Log in to Facebook first");			
+			    xml.append("You need to be logged in to Facebook to use the Mugshot application.");
+		    } else {
+		    	logger.warn("Unexpected combination of Facebook parameters that caused us to not find a matching Mugshot user");
+			    xml.appendTextNode("fb:message", "Log in to Facebook and add Mugshot first");			
+			    xml.append("You need to be logged in to Facebook and have Mugshot application added in order to use Mugshot on Facebook.");		    	
+		    }          
 			xml.closeElement();
 		}		
 		response.setContentType("text/html");



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