Skip to content

Commit

Permalink
SAK-28099; backup code in case event doesn't have a userid; prevent S…
Browse files Browse the repository at this point in the history
…afari from having scroll bar where not needed

git-svn-id: https://source.sakaiproject.org/svn/chat/trunk@315764 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
clhedrick committed Nov 30, 2014
1 parent 7bb512d commit fffc968
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import org.sakaiproject.event.api.EventTrackingService;
import org.sakaiproject.presence.cover.PresenceService;
import org.sakaiproject.user.cover.UserDirectoryService;
import org.sakaiproject.event.cover.UsageSessionService;
import org.sakaiproject.user.api.User;
import org.sakaiproject.event.api.UsageSession;

/**
* <p>
Expand Down Expand Up @@ -144,17 +146,27 @@ public void update(Observable o, Object arg)
if (!check(arg)) return;

Event event = (Event) arg;
String username = "";

String userId = event.getUserId();
String username = "";
if (userId == null) {
String sessionId = event.getSessionId();
if (sessionId != null) {
UsageSession session = UsageSessionService.getSession(sessionId);
if (session != null) {
userId = session.getUserId();
}
}
}

User user = null;
if (userId != null)
try {
user = UserDirectoryService.getUser(userId);
} catch (Exception e) {}
if (user != null)
username = user.getDisplayName();

if(event.getEvent().equals(PresenceService.EVENT_PRESENCE))
presenceObserver.userJoined(location, username);
else
Expand Down
1 change: 1 addition & 0 deletions chat/chat-tool/tool/src/webapp/css/chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ h3 {
padding:0px !important;
margin:0px !important;
padding-top:0.5em !important;
padding-bottom:0.5em !important;
max-height: 40em;
overflow-y: auto;
overflow-x: hidden;
Expand Down

0 comments on commit fffc968

Please sign in to comment.