Author: ludovic
Date: 2008-01-18 02:11:53 +0100 (Fri, 18 Jan 2008)
New Revision: 6954

Modified:
   
xwiki-products/curriki/trunk/plugins/spacemanager/src/main/java/org/xwiki/plugin/spacemanager/impl/SpaceManagerImpl.java
Log:
CURRIKI-1399 Regression No Join group confirmation e-mail sent

Modified: 
xwiki-products/curriki/trunk/plugins/spacemanager/src/main/java/org/xwiki/plugin/spacemanager/impl/SpaceManagerImpl.java
===================================================================
--- 
xwiki-products/curriki/trunk/plugins/spacemanager/src/main/java/org/xwiki/plugin/spacemanager/impl/SpaceManagerImpl.java
    2008-01-18 00:32:30 UTC (rev 6953)
+++ 
xwiki-products/curriki/trunk/plugins/spacemanager/src/main/java/org/xwiki/plugin/spacemanager/impl/SpaceManagerImpl.java
    2008-01-18 01:11:53 UTC (rev 6954)
@@ -535,7 +535,8 @@
         newspace.setType(getSpaceTypeName());
         newspace.setDisplayTitle(spaceTitle);
         newspace.setCreator(context.getUser());
-        //newspace.setCreationTime(context.getWiki().getCurrentDate());
+        newspace.setCreationDate(new Date());
+
         try {
             newspace.saveWithProgrammingRights();
             // we need to add the creator as a member and as an admin
@@ -591,7 +592,7 @@
                 for (Iterator it = list.iterator(); it.hasNext();) {
                     String docname = (String) it.next();
                     XWikiDocument doc = context.getWiki().getDocument(docname, 
context);
-                    context.getWiki().copyDocument(doc.getFullName(), 
newspace.getSpaceName() + "." + doc.getName(), context);
+                    context.getWiki().copyDocument(doc.getFullName(), 
newspace.getSpaceName() + "." + doc.getName(), null, null, null, true, false, 
true, context);
                 }
             } catch (XWikiException e) {
                 throw new SpaceManagerException(e);
@@ -602,6 +603,9 @@
         newspace.setType(getSpaceTypeName());
         // we need to do it twice because data could have been overwritten by 
copyWikiWeb
         newspace.updateSpaceFromRequest();
+        newspace.setCreator(context.getUser());
+        newspace.setCreationDate(new Date());
+        
         try {
             newspace.saveWithProgrammingRights();
             // we need to add the creator as a member and as an admin
@@ -1195,18 +1199,24 @@
         }
     }
 
-    public boolean joinSpace(String spaceName, XWikiContext context) throws 
SpaceManagerException {
+    /**
+     * [EMAIL PROTECTED]
+     * 
+     * @see SpaceManager#joinSpace(String, XWikiContext)
+     */
+    public boolean joinSpace(String spaceName, XWikiContext context) throws 
SpaceManagerException
+    {
         try {
-            SpaceUserProfile userProfile = 
newUserSpaceProfile(context.getUser(), spaceName, context);
+            SpaceUserProfile userProfile =
+                newUserSpaceProfile(context.getUser(), spaceName, context);
             userProfile.updateProfileFromRequest();
             userProfile.saveWithProgrammingRights();
             addMember(spaceName, context.getUser(), context);
+            sendMail(SpaceAction.JOIN, getSpace(spaceName, context), context);
             return true;
         } catch (XWikiException e) {
             throw new SpaceManagerException(e);
         }
-
-
     }
 
     private void sendMail(String action, Space space, XWikiContext context)
@@ -1227,6 +1237,9 @@
             // notify space administrators upon space creation
             Collection admins = getAdmins(space.getSpaceName(), context);
             toUsers = (String[]) admins.toArray(new String[admins.size()]);
+        } else if (SpaceAction.JOIN.equals(action)) {
+            // send join group confirmation e-mail
+            toUsers = new String[] {context.getUser()};
         }
 
         if (fromUser == null) {

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to