summaryrefslogtreecommitdiffstats
path: root/webapp/components/channel_header.jsx
diff options
context:
space:
mode:
authorGabin Aureche <gabin.aureche@live.fr>2017-03-13 13:25:08 +0100
committerGeorge Goldberg <george@gberg.me>2017-03-13 12:25:08 +0000
commitfe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81 (patch)
treeb96d457cde64b7397f91028106e93a7f92a179bd /webapp/components/channel_header.jsx
parent482a0fb5fc248b1ec61db35299dc3e6d963ad5ab (diff)
downloadchat-fe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81.tar.gz
chat-fe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81.tar.bz2
chat-fe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81.zip
Add pinned posts (#4217)
Diffstat (limited to 'webapp/components/channel_header.jsx')
-rw-r--r--webapp/components/channel_header.jsx27
1 files changed, 25 insertions, 2 deletions
diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx
index 01e1e98cf..556e49863 100644
--- a/webapp/components/channel_header.jsx
+++ b/webapp/components/channel_header.jsx
@@ -30,7 +30,7 @@ import * as Utils from 'utils/utils.jsx';
import * as ChannelUtils from 'utils/channel_utils.jsx';
import {getSiteURL} from 'utils/url.jsx';
import * as TextFormatting from 'utils/text_formatting.jsx';
-import {getFlaggedPosts} from 'actions/post_actions.jsx';
+import {getFlaggedPosts, getPinnedPosts} from 'actions/post_actions.jsx';
import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
@@ -53,6 +53,7 @@ export default class ChannelHeader extends React.Component {
this.hideRenameChannelModal = this.hideRenameChannelModal.bind(this);
this.handleShortcut = this.handleShortcut.bind(this);
this.getFlagged = this.getFlagged.bind(this);
+ this.getPinnedPosts = this.getPinnedPosts.bind(this);
this.initWebrtc = this.initWebrtc.bind(this);
this.onBusy = this.onBusy.bind(this);
this.openDirectMessageModal = this.openDirectMessageModal.bind(this);
@@ -158,6 +159,15 @@ export default class ChannelHeader extends React.Component {
}
}
+ getPinnedPosts(e) {
+ e.preventDefault();
+ if (SearchStore.isPinnedPosts) {
+ GlobalActions.toggleSideBarAction(false);
+ } else {
+ getPinnedPosts(this.props.channelId);
+ }
+ }
+
getFlagged(e) {
e.preventDefault();
if (SearchStore.isFlaggedPosts) {
@@ -211,6 +221,7 @@ export default class ChannelHeader extends React.Component {
render() {
const flagIcon = Constants.FLAG_ICON_SVG;
+ const pinIcon = Constants.PIN_ICON;
if (!this.validState()) {
// Use an empty div to make sure the header's height stays constant
@@ -762,8 +773,20 @@ export default class ChannelHeader extends React.Component {
</OverlayTrigger>
</div>
</th>
- <th className='header-list__members'>
+ <th className='header-list__right'>
{popoverListMembers}
+ <a
+ href='#'
+ type='button'
+ id='pinned-posts-button'
+ className='pinned-posts-button'
+ onClick={this.getPinnedPosts}
+ >
+ <span
+ dangerouslySetInnerHTML={{__html: pinIcon}}
+ aria-hidden='true'
+ />
+ </a>
</th>
<th className='search-bar__container'>
<NavbarSearchBox