Skip to content

Commit 6ed8bb9

Browse files
committed
RSDEV-487: Rewrite Group invitation email for a better user experience
1 parent 241dabf commit 6ed8bb9

File tree

9 files changed

+91
-25
lines changed

9 files changed

+91
-25
lines changed

src/main/java/com/axiope/service/cfg/TestAppConfig.java

-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.researchspace.service.IMediaFactory;
2525
import com.researchspace.service.RemoteLicenseService;
2626
import com.researchspace.service.impl.CommunicationManagerImpl;
27-
import com.researchspace.service.impl.DevBroadCaster;
2827
import com.researchspace.service.impl.DeveloperGroupSetup;
2928
import com.researchspace.service.impl.DummyConversionService;
3029
import com.researchspace.service.impl.EcatMediaFactory;
@@ -60,11 +59,6 @@
6059
@EnableAsync
6160
public class TestAppConfig extends BaseConfig {
6261

63-
@Bean
64-
public Broadcaster broadcaster() {
65-
return new DevBroadCaster("run");
66-
}
67-
6862
@Bean(name = "postUserCreate")
6963
public IPostUserCreationSetUp postUserCreationSetup() {
7064
return new NullOpPostUserCreate();

src/main/java/com/researchspace/service/impl/EmailBroadcastImp.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import lombok.Builder;
4949
import lombok.Getter;
5050
import org.apache.commons.lang.RandomStringUtils;
51-
import org.apache.commons.lang.StringUtils;
5251
import org.apache.velocity.tools.generic.DateTool;
5352
import org.jsoup.helper.Validate;
5453
import org.slf4j.Logger;
@@ -323,8 +322,7 @@ public void run() throws Throwable {
323322
}
324323

325324
private void logEmailSendStart(String txt, String id) {
326-
final int maxWidth = 25;
327-
log.info("Sending email [{}] with text :{}", id, StringUtils.abbreviate(txt, maxWidth));
325+
log.info("Sending email [{}] with text :{}", id, txt);
328326
}
329327

330328
// package-scoped for testing

src/main/java/com/researchspace/webapp/controller/DashboardController.java

+26
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.researchspace.model.dtos.NotificationStatus;
1818
import com.researchspace.model.field.ErrorList;
1919
import com.researchspace.model.views.ServiceOperationResult;
20+
import com.researchspace.properties.IPropertyHolder;
2021
import com.researchspace.service.CommunicationManager;
2122
import com.researchspace.service.IMessageAndNotificationTracker;
2223
import com.researchspace.service.RSpaceRequestManager;
@@ -35,15 +36,18 @@
3536
import org.springframework.web.bind.annotation.RequestMapping;
3637
import org.springframework.web.bind.annotation.RequestParam;
3738
import org.springframework.web.bind.annotation.ResponseBody;
39+
import org.springframework.web.servlet.view.RedirectView;
3840

3941
/** Handles URL requests for the Dashboard page, including messaging and notifications. */
4042
@Controller
4143
@RequestMapping("/dashboard")
4244
public class DashboardController extends BaseController {
45+
4346
@Autowired private SystemPropertyPermissionManager systemPropertyPermissionManager;
4447
private @Autowired RSpaceRequestManager reqStatusUpdateMgr;
4548
private @Autowired CommunicationManager commService;
4649
private @Autowired IMessageAndNotificationTracker tracker;
50+
private @Autowired IPropertyHolder propertyHolder;
4751

4852
@GetMapping
4953
public String dashboard(Model model, Principal principal) {
@@ -157,6 +161,28 @@ public AjaxReturnObject<String> updateMessageStatus(
157161
return new AjaxReturnObject<>("Success", null);
158162
}
159163

164+
@GetMapping("/ajax/messageStatus")
165+
@ResponseBody
166+
public RedirectView updateMessageStatusGet(
167+
Principal principal,
168+
@RequestParam("messageOrRequestId") Long messageOrRequestId,
169+
@RequestParam("status") String status,
170+
@RequestParam(value = "optionalMessage", required = false) String optionalMessage) {
171+
CommunicationStatus statusEnum = CommunicationStatus.valueOf(status);
172+
String baseUrl = propertyHolder.getServerUrl();
173+
switch (statusEnum) {
174+
case ACCEPTED:
175+
case COMPLETED:
176+
updateMessageStatus(principal, messageOrRequestId, status, optionalMessage);
177+
return new RedirectView(baseUrl + "/requestAccepted");
178+
case REJECTED:
179+
updateMessageStatus(principal, messageOrRequestId, status, optionalMessage);
180+
return new RedirectView(baseUrl + "/requestDeclined");
181+
default:
182+
return new RedirectView(baseUrl + "/error");
183+
}
184+
}
185+
160186
/**
161187
* Handles a user responding to an original message.
162188
*

src/main/java/com/researchspace/webapp/controller/GroupController.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@
4646
import com.researchspace.model.views.GroupListResult;
4747
import com.researchspace.model.views.ServiceOperationResultCollection;
4848
import com.researchspace.model.views.UserView;
49-
import com.researchspace.service.*;
49+
import com.researchspace.service.AutoshareManager;
50+
import com.researchspace.service.CommunicationManager;
51+
import com.researchspace.service.CommunityServiceManager;
52+
import com.researchspace.service.IContentInitializer;
53+
import com.researchspace.service.IGroupCreationStrategy;
54+
import com.researchspace.service.MessageOrRequestCreatorManager;
55+
import com.researchspace.service.SystemPropertyPermissionManager;
5056
import com.researchspace.session.SessionAttributeUtils;
5157
import java.security.Principal;
5258
import java.util.ArrayList;

src/main/resources/deployments/dev/deployment.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ rs.customer.name.short=RSpace Local
44
rs.usergroup.initfile=deployments/dev/initUsers.csv
55
offline.button.visible=true
66
cache.com.researchspace.model.UserGroup=123
7-
email.enabled=false
7+
email.enabled=true
88

99
api.beta.enabled=true
1010
#api.beta.allowUnauthorizedLinks=true
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
<html>
22
#utf8header
33
<body>
4-
<h2> RSpace Request from $cmm.originator.fullName </h2>
5-
<a href="$baseURL/userform?userId=$cmm.originator.id">$cmm.originator.fullName</a>
6-
sent you a request on #formatDate($dateOb)
7-
#if ($cmm.record && $cmm.record.notebook)
8-
concerning notebook <a href="$baseURL/notebookEditor/$cmm.record.id">$cmm.record.name</a>
9-
<br>
10-
#elseif($cmm.record)
11-
concerning document <a href="$baseURL/workspace/editor/structuredDocument/$cmm.record.id">$cmm.record.name </a>
12-
<br>
13-
#end
4+
<p align="left"><img height="75" src="$baseURL/public/banner"></p>
5+
<h2> RSpace Request from the user "$cmm.originator.username" </h2>
6+
The RSpace Principal Investigator "<b>$cmm.originator.username</b>" has invited you to join the Lab Group
7+
"<b>$cmm.group.displayName</b>" on $date.format('full_date', $dateOb) at $date.format('short_time', $dateOb)
8+
<p>
9+
Click to
10+
<a rel="nofollow" target="_blank" class="word-wrap"
11+
href="$baseURL/dashboard/ajax/messageStatus?messageOrRequestId=$cmm.id&status=COMPLETED">ACCEPT</a>
12+
or
13+
<a rel="nofollow" target="_blank" class="word-wrap"
14+
href="$baseURL/dashboard/ajax/messageStatus?messageOrRequestId=$cmm.id&status=REJECTED">REJECT</a>
15+
this invitation, then log in to RSpace with your credentials.
16+
<br/><br/>
1417

15-
#if ($cmm.message)
18+
19+
#if ($cmm.record && $cmm.record.notebook)
20+
concerning notebook <a href="$baseURL/notebookEditor/$cmm.record.id">$cmm.record.name</a>
21+
<br>
22+
#elseif($cmm.record)
23+
concerning document <a href="$baseURL/workspace/editor/structuredDocument/$cmm.record.id">$cmm.record.name </a>
24+
<br>
25+
#end
26+
27+
#if ($cmm.message)
1628
More details: <br>
17-
$cmm.message
18-
#end
29+
$cmm.message
30+
#end
1931
<p/>
2032
#dontReply
2133
</body>
22-
</html>
34+
</html>

src/main/webapp/WEB-INF/dispatcher-servlet.xml

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
<mvc:view-controller path="/public/terms" view-name="public/terms" />
9191
<mvc:view-controller path="/public/ssoinfo" view-name="public/ssoinfo" />
9292
<mvc:view-controller path="/public/ssologout" view-name="public/ssologout" />
93+
<mvc:view-controller path="/requestAccepted" view-name="requestAccepted" />
94+
<mvc:view-controller path="/requestDeclined" view-name="requestDeclined" />
9395
<mvc:view-controller path="/public/ipAddressInvalid" view-name="public/ipAddressInvalid" />
9496
<mvc:view-controller path="/public/apiDocs" view-name="public/apiDocs" />
9597
<mvc:view-controller path="/test/template" view-name="/test/template" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<%@ include file="/common/taglibs.jsp"%>
2+
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+
<meta charset="UTF-8">
6+
<title>Request Accepted</title>
7+
</head>
8+
<body>
9+
<p style="font-size:18px">Your request has been successfully <b>accepted!</b>
10+
<img height="20" src="images/tick-icon.png">
11+
</p>
12+
<br/>
13+
<a href="../workspace"> Return to workspace </a>
14+
</body>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<%@ include file="/common/taglibs.jsp"%>
2+
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+
<meta charset="UTF-8">
6+
<title>Request Declined</title>
7+
</head>
8+
<body>
9+
<p style="font-size:18px">Your request has been successfully <b>declined!</b>
10+
<img height="20" src="images/tick-icon.png">
11+
</p>
12+
<br/><br/>
13+
<a href="../workspace"> Return to workspace </a>
14+
</body>

0 commit comments

Comments
 (0)