r7422 - in dumbhippo/trunk/server/src/com/dumbhippo: server server/impl web/servlets
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7422 - in dumbhippo/trunk/server/src/com/dumbhippo: server server/impl web/servlets
- Date: Wed, 16 Apr 2008 12:38:47 -0500 (CDT)
Author: walters
Date: 2008-04-16 12:38:47 -0500 (Wed, 16 Apr 2008)
New Revision: 7422
Modified:
dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java
dumbhippo/trunk/server/src/com/dumbhippo/server/IdentitySpider.java
dumbhippo/trunk/server/src/com/dumbhippo/server/PostingBoard.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/IdentitySpiderBean.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/MessengerGlueBean.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/PostingBoardBean.java
dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java
Log:
Bug #1387: Fixes for Mugshot-enabling.
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java 2008-04-16 15:58:37 UTC (rev 7421)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java 2008-04-16 17:38:47 UTC (rev 7422)
@@ -245,7 +245,7 @@
@HttpContentTypes(HttpResponseData.NONE)
@HttpParams( {} )
@HttpOptions( allowDisabledAccount = true )
- public void doAcceptTerms(UserViewpoint viewpoint);
+ public void doAcceptTerms(UserViewpoint viewpoint) throws RetryException;
@HttpContentTypes(HttpResponseData.NONE)
@HttpParams( { "needsDownload" } )
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/IdentitySpider.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/IdentitySpider.java 2008-04-16 15:58:37 UTC (rev 7421)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/IdentitySpider.java 2008-04-16 17:38:47 UTC (rev 7422)
@@ -376,6 +376,12 @@
*/
public User getUser(Resource resource);
+ /**
+ * Enable Mugshot features for user, and send them the initial share.
+ * @throws RetryException
+ */
+ public void setPublicPage(UserViewpoint view, boolean enabled) throws RetryException;
+
/**
* Tries to find a good resource to use to represent person.
* If person is a User, returns the user's account. If the
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/PostingBoard.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/PostingBoard.java 2008-04-16 15:58:37 UTC (rev 7421)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/PostingBoard.java 2008-04-16 17:38:47 UTC (rev 7422)
@@ -76,6 +76,8 @@
public void doGroupInvitationPost(Viewpoint viewpoint, User owner, Group group) throws RetryException;
+ public void doInitialShare(UserViewpoint newUser) throws RetryException;
+
public void doShareLinkTutorialPost(Viewpoint viewpoint, User recipient) throws RetryException;
public void doNowPlayingTutorialPost(Viewpoint viewpoint, User recipient) throws RetryException;
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java 2008-04-16 15:58:37 UTC (rev 7421)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java 2008-04-16 17:38:47 UTC (rev 7422)
@@ -1236,10 +1236,10 @@
out.flush();
}
- public void doAcceptTerms(UserViewpoint viewpoint) {
+ public void doAcceptTerms(UserViewpoint viewpoint) throws RetryException {
viewpoint.getViewer().getAccount().setHasAcceptedTerms(true);
if (viewpoint.getViewer().getAccount().getAccountType() == AccountType.MUGSHOT) {
- viewpoint.getViewer().getAccount().setPublicPage(true);
+ identitySpider.setPublicPage(viewpoint, true);
}
}
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/IdentitySpiderBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/IdentitySpiderBean.java 2008-04-16 15:58:37 UTC (rev 7421)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/IdentitySpiderBean.java 2008-04-16 17:38:47 UTC (rev 7422)
@@ -70,6 +70,7 @@
import com.dumbhippo.server.Notifier;
import com.dumbhippo.server.OnlineDesktopSystem;
import com.dumbhippo.server.PermissionDeniedException;
+import com.dumbhippo.server.PostingBoard;
import com.dumbhippo.server.RevisionControl;
import com.dumbhippo.server.dm.ContactDMO;
import com.dumbhippo.server.dm.DataService;
@@ -119,6 +120,10 @@
@EJB
private OnlineDesktopSystem onlineDesktop;
+ @EJB
+ @IgnoreDependency
+ private PostingBoard postingBoard;
+
public User lookupUserByEmail(Viewpoint viewpoint, String email) throws NotFoundException {
EmailResource res = lookupEmail(email);
// lookupEmail will normally throw a NotFoundException if the resource is not found,
@@ -1374,4 +1379,11 @@
}
return contacts;
}
+
+ public void setPublicPage(UserViewpoint view, boolean enabled) throws RetryException {
+ view.getViewer().getAccount().setPublicPage(enabled);
+ if (enabled && !view.getViewer().getAccount().getWasSentShareLinkTutorial()) {
+ postingBoard.doInitialShare(view);
+ }
+ }
}
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/MessengerGlueBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/MessengerGlueBean.java 2008-04-16 15:58:37 UTC (rev 7421)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/MessengerGlueBean.java 2008-04-16 17:38:47 UTC (rev 7422)
@@ -213,36 +213,7 @@
return user;
}
-
- private void doShareLinkTutorial(UserViewpoint newUser) throws RetryException {
- logger.debug("We have a new user!!!!! WOOOOOOOOOOOOHOOOOOOOOOOOOOOO send them tutorial!");
- Account account = newUser.getViewer().getAccount();
-
- InvitationToken invite = invitationSystem.getCreatingInvitation(account);
-
- // see what feature the user was sold on originally, and share the right thing
- // with them accordingly
-
- User owner = newUser.getViewer();
- if (invite != null && invite.getPromotionCode() == PromotionCode.MUSIC_INVITE_PAGE_200602)
- postingBoard.doNowPlayingTutorialPost(newUser, owner);
- else {
- Set<Group> invitedToGroups = groupSystem.findRawGroups(newUser, owner, MembershipStatus.INVITED);
- Set<Group> invitedToFollowGroups = groupSystem.findRawGroups(newUser, owner, MembershipStatus.INVITED_TO_FOLLOW);
- invitedToGroups.addAll(invitedToFollowGroups);
- if (invitedToGroups.size() == 0) {
- postingBoard.doShareLinkTutorialPost(newUser, owner);
- } else {
- for (Group group : invitedToGroups) {
- postingBoard.doGroupInvitationPost(newUser, owner, group);
- }
- }
- }
-
- account.setWasSentShareLinkTutorial(true);
- }
-
public void updateLoginDate(Guid userId, Date timestamp) {
// account could be missing due to debug users or our own
// send-notifications user. In fact any user on the jabber server
@@ -272,19 +243,7 @@
}
public void sendConnectedResourceNotifications(Guid userId, boolean wasAlreadyConnected) throws RetryException {
- Account account;
- try {
- account = accountFromUserId(userId);
- } catch (JabberUserNotFoundException e) {
- logger.warn("username signed on that we don't know: {}", userId);
- return;
- }
-
- UserViewpoint viewpoint = new UserViewpoint(account.getOwner(), Site.XMPP);
-
- if (!account.getWasSentShareLinkTutorial()) {
- doShareLinkTutorial(viewpoint);
- }
+ // This used to send a share link tutorial, now we always do it when the account is enabled
}
private User getUserFromGuid(Guid guid) {
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/PostingBoardBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/PostingBoardBean.java 2008-04-16 15:58:37 UTC (rev 7421)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/PostingBoardBean.java 2008-04-16 17:38:47 UTC (rev 7422)
@@ -32,6 +32,7 @@
import com.dumbhippo.live.GroupEvent;
import com.dumbhippo.live.LiveState;
import com.dumbhippo.live.PostCreatedEvent;
+import com.dumbhippo.persistence.Account;
import com.dumbhippo.persistence.AccountClaim;
import com.dumbhippo.persistence.Block;
import com.dumbhippo.persistence.FeedEntry;
@@ -41,6 +42,7 @@
import com.dumbhippo.persistence.GroupFeed;
import com.dumbhippo.persistence.GroupMember;
import com.dumbhippo.persistence.GuidPersistable;
+import com.dumbhippo.persistence.InvitationToken;
import com.dumbhippo.persistence.MembershipStatus;
import com.dumbhippo.persistence.Person;
import com.dumbhippo.persistence.Post;
@@ -69,6 +71,7 @@
import com.dumbhippo.server.PostSearchResult;
import com.dumbhippo.server.PostType;
import com.dumbhippo.server.PostingBoard;
+import com.dumbhippo.server.PromotionCode;
import com.dumbhippo.server.RecommenderSystem;
import com.dumbhippo.server.blocks.PostBlockHandler;
import com.dumbhippo.server.dm.DataService;
@@ -388,11 +391,37 @@
logger.debug("Tutorial post done: {}", post);
}
+ public void doInitialShare(UserViewpoint newUser) throws RetryException {
+ logger.debug("We have a new user!!!!! WOOOOOOOOOOOOHOOOOOOOOOOOOOOO send them tutorial!");
+
+ Account account = newUser.getViewer().getAccount();
+
+ InvitationToken invite = invitationSystem.getCreatingInvitation(account);
+
+ // see what feature the user was sold on originally, and share the right thing
+ // with them accordingly
+
+ User owner = newUser.getViewer();
+ if (invite != null && invite.getPromotionCode() == PromotionCode.MUSIC_INVITE_PAGE_200602)
+ doNowPlayingTutorialPost(newUser, owner);
+ else {
+ doShareLinkTutorialPost(newUser, owner);
+ Set<Group> invitedToGroups = groupSystem.findRawGroups(newUser, owner, MembershipStatus.INVITED);
+ Set<Group> invitedToFollowGroups = groupSystem.findRawGroups(newUser, owner, MembershipStatus.INVITED_TO_FOLLOW);
+ invitedToGroups.addAll(invitedToFollowGroups);
+ for (Group group : invitedToGroups) {
+ doGroupInvitationPost(newUser, owner, group);
+ }
+ }
+
+ account.setWasSentShareLinkTutorial(true);
+ }
+
public void doShareLinkTutorialPost(Viewpoint viewpoint, User recipient) throws RetryException {
doTutorialPost(viewpoint, recipient, Character.LOVES_ACTIVITY,
configuration.getBaseUrl(viewpoint) + "/account",
- "What is this Mugshot thing?",
- "Set up your account and learn to use Mugshot by visiting this link");
+ "Welcome to Mugshot!",
+ "Learn how you can create shares like this to send to your friends, and see what other features Mugshot offers.");
}
public void doNowPlayingTutorialPost(Viewpoint viewpoint, User recipient) throws RetryException {
Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java 2008-04-16 15:58:37 UTC (rev 7421)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java 2008-04-16 17:38:47 UTC (rev 7422)
@@ -12,6 +12,7 @@
import org.slf4j.Logger;
import com.dumbhippo.GlobalSetup;
+import com.dumbhippo.Site;
import com.dumbhippo.persistence.AccountClaim;
import com.dumbhippo.persistence.Client;
import com.dumbhippo.persistence.FacebookAccount;
@@ -28,6 +29,7 @@
import com.dumbhippo.server.Configuration.PropertyNotFoundException;
import com.dumbhippo.server.dm.DataService;
import com.dumbhippo.server.dm.UserDMO;
+import com.dumbhippo.server.views.UserViewpoint;
import com.dumbhippo.services.FacebookWebServices;
import com.dumbhippo.tx.RetryException;
import com.dumbhippo.web.SigninBean;
@@ -96,7 +98,7 @@
sess.invalidate();
SigninBean.initializeAuthentication(request, response, client);
if (!ac.getOwner().getAccount().isPublicPage()) {
- ac.getOwner().getAccount().setPublicPage(true);
+ identitySpider.setPublicPage(new UserViewpoint(ac.getOwner(), Site.MUGSHOT), true);
String regularCountString = config.getProperty(HippoProperty.NEW_USER_INVITATION_COUNT);
int regularCount = Integer.parseInt(regularCountString);
ac.getOwner().getAccount().setInvitations(regularCount);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]