[Notice] Announcing the End of Demo Server [Read me]
member: Fix 'member is accepted' link bug
@2305231db2b1432680d2dfd2b9442b78467b06ab
--- app/models/NotificationEvent.java
+++ app/models/NotificationEvent.java
... | ... | @@ -527,6 +527,7 @@ |
527 | 527 |
} |
528 | 528 |
|
529 | 529 |
public String getUrlToView() { |
530 |
+ Organization organization; |
|
530 | 531 |
switch(eventType) { |
531 | 532 |
case MEMBER_ENROLL_REQUEST: |
532 | 533 |
if (getProject() == null) { |
... | ... | @@ -535,13 +536,25 @@ |
535 | 536 |
return routes.ProjectApp.members( |
536 | 537 |
getProject().owner, getProject().name).url(); |
537 | 538 |
} |
539 |
+ case MEMBER_ENROLL_ACCEPT: |
|
540 |
+ if (getProject() == null) { |
|
541 |
+ return null; |
|
542 |
+ } else { |
|
543 |
+ return routes.ProjectApp.project( |
|
544 |
+ getProject().owner, getProject().name).url(); |
|
545 |
+ } |
|
538 | 546 |
case ORGANIZATION_MEMBER_ENROLL_REQUEST: |
539 |
- Organization organization = getOrganization(); |
|
547 |
+ organization = getOrganization(); |
|
540 | 548 |
if (organization == null) { |
541 | 549 |
return null; |
542 | 550 |
} |
543 | 551 |
return routes.OrganizationApp.members(organization.name).url(); |
544 |
- |
|
552 |
+ case ORGANIZATION_MEMBER_ENROLL_ACCEPT: |
|
553 |
+ organization = getOrganization(); |
|
554 |
+ if (organization == null) { |
|
555 |
+ return null; |
|
556 |
+ } |
|
557 |
+ return routes.OrganizationApp.organization(organization.name).url(); |
|
545 | 558 |
case NEW_COMMIT: |
546 | 559 |
if (getProject() == null) { |
547 | 560 |
return null; |
... | ... | @@ -1162,6 +1175,7 @@ |
1162 | 1175 |
break; |
1163 | 1176 |
case ACCEPT: |
1164 | 1177 |
notiEvent.title = formatMemberAcceptTitle(project, user); |
1178 |
+ notiEvent.eventType = MEMBER_ENROLL_ACCEPT; |
|
1165 | 1179 |
notiEvent.oldValue = RequestState.REQUEST.name(); |
1166 | 1180 |
break; |
1167 | 1181 |
} |
... | ... | @@ -1192,6 +1206,7 @@ |
1192 | 1206 |
break; |
1193 | 1207 |
case ACCEPT: |
1194 | 1208 |
notiEvent.title = formatMemberAcceptTitle(organization, user); |
1209 |
+ notiEvent.eventType = ORGANIZATION_MEMBER_ENROLL_ACCEPT; |
|
1195 | 1210 |
notiEvent.oldValue = RequestState.REQUEST.name(); |
1196 | 1211 |
break; |
1197 | 1212 |
} |
--- app/models/NotificationMail.java
+++ app/models/NotificationMail.java
... | ... | @@ -52,6 +52,7 @@ |
52 | 52 |
import java.util.concurrent.TimeUnit; |
53 | 53 |
|
54 | 54 |
import static models.enumeration.EventType.*; |
55 |
+import static models.enumeration.ResourceType.ORGANIZATION; |
|
55 | 56 |
|
56 | 57 |
@Entity |
57 | 58 |
public class NotificationMail extends Model { |
... | ... | @@ -620,10 +621,10 @@ |
620 | 621 |
|
621 | 622 |
String renderred = null; |
622 | 623 |
|
623 |
- if(resource != null) { |
|
624 |
- renderred = Markdown.render(message, resource.getProject(), lang.code()); |
|
625 |
- } else { |
|
624 |
+ if (resource == null || resource.getType() == ORGANIZATION) { |
|
626 | 625 |
renderred = Markdown.render(message); |
626 |
+ } else { |
|
627 |
+ renderred = Markdown.render(message, resource.getProject(), lang.code()); |
|
627 | 628 |
} |
628 | 629 |
|
629 | 630 |
return getRenderedMail(lang, renderred, urlToView, resource, acceptsReply); |
--- app/models/enumeration/EventType.java
+++ app/models/enumeration/EventType.java
... | ... | @@ -39,7 +39,9 @@ |
39 | 39 |
ISSUE_LABEL_CHANGED("notification.type.issue.label.changed", 23), |
40 | 40 |
ISSUE_MILESTONE_CHANGED("notification.type.milestone.changed", 24), |
41 | 41 |
POSTING_BODY_CHANGED("notification.type.posting.body.changed", 25), |
42 |
- RESOURCE_DELETED("notification.type.resource.deleted", 26); |
|
42 |
+ RESOURCE_DELETED("notification.type.resource.deleted", 26), |
|
43 |
+ MEMBER_ENROLL_ACCEPT("notification.member.enroll.accept", 27), |
|
44 |
+ ORGANIZATION_MEMBER_ENROLL_ACCEPT("notification.member.enroll.accept", 28); |
|
43 | 45 |
|
44 | 46 |
private String descr; |
45 | 47 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?