summaryrefslogtreecommitdiffstats
path: root/webapp/components/post_view
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2016-12-22 17:19:19 +0000
committerenahum <nahumhbl@gmail.com>2016-12-22 14:19:19 -0300
commita857cf18f4809ab5fbff4956b42430e5eeddb54e (patch)
treefc6dee02b37c9ca1ae457ce0d98724abae91e32d /webapp/components/post_view
parent52c4538817c310977474dd94c8e828f6489dadab (diff)
downloadchat-a857cf18f4809ab5fbff4956b42430e5eeddb54e.tar.gz
chat-a857cf18f4809ab5fbff4956b42430e5eeddb54e.tar.bz2
chat-a857cf18f4809ab5fbff4956b42430e5eeddb54e.zip
PLT-4860 Make ProfilePopover into it's own component and use it consistently everywhere (#4701)
* PLT-4860 - Use same User Popover everywhere. Refactor out the ProfilePopover into it's own component and give it the union of all the features of the previous two implementations, and make sure all the necessary data for it to work consistently everywhere is provided through the props wherever it is used. * Don't show popover for webhook posts in main view. * No popover on RHS when it's a webhook post. * Fix style. * Don't send in user when it's a system message. * Fix some duplication of code.
Diffstat (limited to 'webapp/components/post_view')
-rw-r--r--webapp/components/post_view/components/post.jsx32
-rw-r--r--webapp/components/post_view/components/post_header.jsx8
2 files changed, 33 insertions, 7 deletions
diff --git a/webapp/components/post_view/components/post.jsx b/webapp/components/post_view/components/post.jsx
index ce6ce7d2a..f052ac4ae 100644
--- a/webapp/components/post_view/components/post.jsx
+++ b/webapp/components/post_view/components/post.jsx
@@ -194,9 +194,18 @@ export default class Post extends React.Component {
src={PostUtils.getProfilePicSrcForPost(post, timestamp)}
status={status}
user={this.props.user}
+ isBusy={this.props.isBusy}
/>
);
+ if (post.props && post.props.from_webhook) {
+ profilePic = (
+ <ProfilePicture
+ src={PostUtils.getProfilePicSrcForPost(post, timestamp)}
+ />
+ );
+ }
+
if (PostUtils.isSystemMessage(post)) {
profilePic = (
<span
@@ -215,13 +224,22 @@ export default class Post extends React.Component {
if (this.props.compactDisplay) {
compactClass = 'post--compact';
- profilePic = (
- <ProfilePicture
- src=''
- status={status}
- user={this.props.user}
- />
- );
+ if (post.props && post.props.from_webhook) {
+ profilePic = (
+ <ProfilePicture
+ src=''
+ status={status}
+ isBusy={this.props.isBusy}
+ user={this.props.user}
+ />
+ );
+ } else {
+ profilePic = (
+ <ProfilePicture
+ src=''
+ />
+ );
+ }
}
const profilePicContainer = (<div className='post__img'>{profilePic}</div>);
diff --git a/webapp/components/post_view/components/post_header.jsx b/webapp/components/post_view/components/post_header.jsx
index ff691c12b..4043460a3 100644
--- a/webapp/components/post_view/components/post_header.jsx
+++ b/webapp/components/post_view/components/post_header.jsx
@@ -40,6 +40,14 @@ export default class PostHeader extends React.Component {
disablePopover={true}
/>
);
+ } else {
+ userProfile = (
+ <UserProfile
+ user={this.props.user}
+ displayNameType={this.props.displayNameType}
+ disablePopover={true}
+ />
+ );
}
botIndicator = <li className='bot-indicator'>{Constants.BOT_NAME}</li>;