diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-06-06 10:35:37 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-06-06 10:35:37 -0400 |
commit | 3dc625a8bdafd34f924a08938fedf13b271af24e (patch) | |
tree | aa4661a71dcd93a5e14a886af13b5f34480c2b16 /webapp/components/sidebar.jsx | |
parent | 46fc47e520efeff328db9b125c5339baac7b88e5 (diff) | |
download | chat-3dc625a8bdafd34f924a08938fedf13b271af24e.tar.gz chat-3dc625a8bdafd34f924a08938fedf13b271af24e.tar.bz2 chat-3dc625a8bdafd34f924a08938fedf13b271af24e.zip |
PLT-6705 Show partially hidden channels as 'Unread above/below' (#6580)
Diffstat (limited to 'webapp/components/sidebar.jsx')
-rw-r--r-- | webapp/components/sidebar.jsx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx index 6fd82f3a7..b998700d8 100644 --- a/webapp/components/sidebar.jsx +++ b/webapp/components/sidebar.jsx @@ -249,10 +249,13 @@ export default class Sidebar extends React.Component { var showTopUnread = false; var showBottomUnread = false; + // Consider partially obscured channels as above/below + const unreadMargin = 15; + if (this.firstUnreadChannel) { var firstUnreadElement = $(ReactDOM.findDOMNode(this.refs[this.firstUnreadChannel])); - if (firstUnreadElement.position().top + firstUnreadElement.height() < 0) { + if (firstUnreadElement.position().top + firstUnreadElement.height() < unreadMargin) { showTopUnread = true; } } @@ -260,7 +263,7 @@ export default class Sidebar extends React.Component { if (this.lastUnreadChannel) { var lastUnreadElement = $(ReactDOM.findDOMNode(this.refs[this.lastUnreadChannel])); - if (lastUnreadElement.position().top > container.height()) { + if (lastUnreadElement.position().top > container.height() - unreadMargin) { showBottomUnread = true; } } |