Skip to content

Commit 4b16383

Browse files
committed
Merge pull request sakaiproject#443 from pushyamig/master
SAK-29272 drafted forums/topic is included in the /topic feed
2 parents 7146835 + c1995cb commit 4b16383

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/entity/DecoratedForumInfo.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ public class DecoratedForumInfo {
1212
private String description;
1313
private List<DecoratedAttachment> attachments;
1414
private Boolean isLocked;
15+
private Boolean isDraft;
16+
1517
private Boolean isPostFirst;
1618
private Boolean isAvailabilityRestricted;
1719
private Long openDate; // An epoch date in seconds. NOT milliseconds.
1820
private Long closeDate; // An epoch date in seconds. NOT milliseconds.
1921
private String gradebookItemName;
2022
private Long gradebookItemId;
23+
24+
2125

2226
public DecoratedForumInfo(Long forumId, String forumTitle,
2327
List<DecoratedAttachment> attachments, String shortDescription,
@@ -31,11 +35,12 @@ public DecoratedForumInfo(Long forumId, String forumTitle,
3135

3236
public DecoratedForumInfo(Long forumId, String forumTitle,
3337
List<DecoratedAttachment> attachments, String shortDescription,
34-
String description, Boolean isLocked, Boolean isPostFirst,
38+
String description, Boolean isLocked, Boolean isDraft, Boolean isPostFirst,
3539
Boolean isAvailabilityRestricted, Long openDate, Long closeDate,
3640
String gradebookItemName, Long gradebookItemId) {
3741
this(forumId, forumTitle, attachments, shortDescription, description);
3842
this.isLocked = isLocked;
43+
this.isDraft=isDraft;
3944
this.isPostFirst = isPostFirst;
4045
this.isAvailabilityRestricted = isAvailabilityRestricted;
4146
this.openDate = openDate;
@@ -79,7 +84,16 @@ public Boolean getIsLocked() {
7984
public void setIsLocked(Boolean isLocked) {
8085
this.isLocked = isLocked;
8186
}
87+
public Boolean getIsDraft() {
88+
return isDraft;
89+
}
90+
91+
public void setIsDraft(Boolean isDraft) {
92+
this.isDraft = isDraft;
93+
}
8294

95+
96+
8397
public Boolean getIsPostFirst() {
8498
return isPostFirst;
8599
}

msgcntr/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/entity/DecoratedTopicInfo.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ public class DecoratedTopicInfo {
1313
private String description;
1414

1515
private Boolean isLocked;
16+
private Boolean isDraft;
17+
18+
1619
private Boolean isPostFirst;
1720
private Boolean isAvailabilityRestricted;
1821
private Long openDate; // An epoch date in seconds. NOT milliseconds.
1922
private Long closeDate; // An epoch date in seconds. NOT milliseconds.
2023
private String gradebookItemName;
2124
private Long gradebookItemId;
25+
2226

2327
public DecoratedTopicInfo(Long topicId, String topicTitle,
2428
int unreadMessagesCount, int messagesCount, String typeUuid,
@@ -38,13 +42,14 @@ public DecoratedTopicInfo(Long topicId, String topicTitle,
3842
public DecoratedTopicInfo(Long topicId, String topicTitle,
3943
int unreadMessagesCount, int messagesCount, String typeUuid,
4044
List<DecoratedAttachment> attachments, String shortDescription,
41-
String description, Boolean isLocked, Boolean isPostFirst,
45+
String description, Boolean isLocked, Boolean isDraft, Boolean isPostFirst,
4246
Boolean isAvailabilityRestricted, Long openDate, Long closeDate,
4347
String gradebookItemName, Long gradebookItemId) {
4448

4549
this(topicId, topicTitle, unreadMessagesCount, messagesCount, typeUuid,
4650
attachments, shortDescription, description);
4751
this.isLocked = isLocked;
52+
this.isDraft=isDraft;
4853
this.isPostFirst = isPostFirst;
4954
this.isAvailabilityRestricted = isAvailabilityRestricted;
5055
this.openDate = openDate;
@@ -100,6 +105,15 @@ public Boolean getIsLocked() {
100105
public void setIsLocked(Boolean isLocked) {
101106
this.isLocked = isLocked;
102107
}
108+
public Boolean getIsDraft() {
109+
return isDraft;
110+
}
111+
112+
public void setIsDraft(Boolean isDraft) {
113+
this.isDraft = isDraft;
114+
}
115+
116+
103117

104118
public Boolean getIsPostFirst() {
105119
return isPostFirst;

msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/TopicEntityProviderImpl.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ public List<?> getEntities(EntityReference ref, Search search) {
375375
}
376376

377377
for (DiscussionForum forum : forums) {
378-
if(forum.getDraft().equals(Boolean.FALSE)){
379378
List<DecoratedAttachment> forumAttachments = decorateAttachments(forum.getAttachments());
380379
Long forumOpenDate = null;
381380
Long forumCloseDate = null;
@@ -390,13 +389,12 @@ public List<?> getEntities(EntityReference ref, Search search) {
390389
forumGbItemId = gbItemNameToId.get(forum.getDefaultAssignName());
391390
}
392391

393-
DecoratedForumInfo dForum = new DecoratedForumInfo(forum.getId(), forum.getTitle(), forumAttachments, forum.getShortDescription(), forum.getExtendedDescription(), forum.getLocked(),
392+
DecoratedForumInfo dForum = new DecoratedForumInfo(forum.getId(), forum.getTitle(), forumAttachments, forum.getShortDescription(), forum.getExtendedDescription(), forum.getLocked(),forum.getDraft(),
394393
forum.getPostFirst(), forum.getAvailabilityRestricted(), forumOpenDate, forumCloseDate, forum.getDefaultAssignName(), forumGbItemId);
395394
List<DiscussionTopic> topics = forum.getTopics();
396395
int viewableTopics = 0;
397396

398397
for (DiscussionTopic topic : topics) {
399-
if(topic.getDraft().equals(Boolean.FALSE)){
400398

401399
if (forumManager.isInstructor(userId, siteId) ||
402400
getUiPermissionsManager().isRead(topic.getId(), topic.getDraft(), forum.getDraft(), userId, siteId))
@@ -432,19 +430,17 @@ public List<?> getEntities(EntityReference ref, Search search) {
432430
}
433431

434432
dForum.addTopic(new DecoratedTopicInfo(topic.getId(), topic.getTitle(), unreadMessages,
435-
totalMessages, "", attachments, topic.getShortDescription(), topic.getExtendedDescription(), topic.getLocked(), topic.getPostFirst(), topic.getAvailabilityRestricted(),
433+
totalMessages, "", attachments, topic.getShortDescription(), topic.getExtendedDescription(), topic.getLocked(), topic.getDraft(), topic.getPostFirst(), topic.getAvailabilityRestricted(),
436434
topicOpenDate, topicCloseDate, topic.getDefaultAssignName(), topicGbItemId));
437435
viewableTopics++;
438436
}
439-
}
440437
}
441438

442439
// TODO this is a bit too simplistic but will do for now. better to be more restrictive than less at this point
443440
// "instructor" type users can view all forums. others may view the forum if they can view at least one topic within the forum
444441
if (forumManager.isInstructor(userId, siteId) || viewableTopics > 0) {
445442
dForums.add(dForum);
446443
}
447-
}
448444
}
449445
}
450446

0 commit comments

Comments
 (0)