Skip to content

Commit

Permalink
LSNBLDR-916: Incorrect name displayed in Forums widget (sakaiproject#…
Browse files Browse the repository at this point in the history
…5152)

* LSNBLDR-916: Incorrect name displayed  in Forums widget

* Update ForumsEntityProviderImpl.java
  • Loading branch information
nicholaswilson100 authored and ern committed Jan 2, 2018
1 parent 7abb377 commit add25a9
Showing 3 changed files with 18 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lessonbuilder/tool/src/webapp/js/forum-summary.js
Original file line number Diff line number Diff line change
@@ -24,10 +24,10 @@ function showForums(forumsUrl, toolHref, itemsToShow, forumSummaryDiv ){
success: function(data) {
$(data["forums_collection"]).each(function(fc_index, fc_value){
var author;
if(fc_value['modifiedBy'].indexOf('(') > -1){
author = fc_value['modifiedBy'].split('(')[0];
if(fc_value['createdBy'].indexOf('(') > -1){
author = fc_value['createdBy'].split('(')[0];
}else{
author = fc_value['modifiedBy'];
author = fc_value['createdBy'];
}
//escape markup
var entityTitle = fc_value['entityTitle'].replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
@@ -75,4 +75,4 @@ function outputForums(messagesArray, toolHref, forumSummaryDiv){
text_for_forums+='</ul>';
}
forumSummaryDiv.html(text_for_forums);
}
}
Original file line number Diff line number Diff line change
@@ -514,10 +514,16 @@ public Object displayMessages(EntityView view, Map<String, Object> params) {
for(Message fm : (List<Message>) forumManager.getRecentDiscussionForumThreadsByTopicIds(topicIds, numberOfMessages)) {
//message has user_Id set in the 'modifiedBy' field, setting it to 'displayId' for display purpose
try {
String displayName = userDirectoryService.getUser(fm.getModifiedBy()).getDisplayName();
fm.setModifiedBy(displayName);
String createdByDisplayName = userDirectoryService.getUser(fm.getCreatedBy()).getDisplayName();
fm.setCreatedBy(createdByDisplayName);
} catch (UserNotDefinedException e) {
log.debug(" User not defined for id '" + fm.getModifiedBy() + "'.");
log.debug("User not defined for id '{}'.", fm.getCreatedBy());
}
try {
String modifiedByDisplayName = userDirectoryService.getUser(fm.getModifiedBy()).getDisplayName();
fm.setModifiedBy(modifiedByDisplayName);
} catch (UserNotDefinedException e) {
log.debug("User not defined for id '{}'.", fm.getModifiedBy());
}
SparseMessage sm = new SparseMessage(fm,/* readStatus =*/ false,/* addAttachments =*/ true, developerHelperService.getServerURL());
Topic topic = fm.getTopic();
Original file line number Diff line number Diff line change
@@ -80,6 +80,9 @@ public class SparseMessage{
@Getter @Setter
private String modifiedBy;

@Getter @Setter
private String createdBy;

//this is used for displaying recent messages in the lessons
private Long forumId;

@@ -113,6 +116,7 @@ public SparseMessage(Message fatMessage, Boolean readStatus, boolean addAttachme
}
}
this.modifiedBy = fatMessage.getModifiedBy();
this.createdBy = fatMessage.getCreatedBy();
}

public SparseMessage(SparseMessage that) {
@@ -150,4 +154,4 @@ public Long getForumId() {
public void setForumId(Long forumId) {
this.forumId = forumId;
}
}
}

0 comments on commit add25a9

Please sign in to comment.