Merge pull request #2589 from mattermost/plt-1812
PLT-1812 Update webhook posts to never show in collapsed view
Этот коммит содержится в:
@@ -172,8 +172,6 @@ func CreateWebhookPost(c *Context, channelId, text, overrideUsername, overrideIc
|
|||||||
if utils.Cfg.ServiceSettings.EnablePostIconOverride {
|
if utils.Cfg.ServiceSettings.EnablePostIconOverride {
|
||||||
if len(overrideIconUrl) != 0 {
|
if len(overrideIconUrl) != 0 {
|
||||||
post.AddProp("override_icon_url", overrideIconUrl)
|
post.AddProp("override_icon_url", overrideIconUrl)
|
||||||
} else {
|
|
||||||
post.AddProp("override_icon_url", model.DEFAULT_WEBHOOK_ICON)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,6 +188,8 @@ export default class Post extends React.Component {
|
|||||||
if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
|
if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
|
||||||
if (post.props.override_icon_url) {
|
if (post.props.override_icon_url) {
|
||||||
src = post.props.override_icon_url;
|
src = post.props.override_icon_url;
|
||||||
|
} else {
|
||||||
|
src = Constants.DEFAULT_WEBHOOK_LOGO;
|
||||||
}
|
}
|
||||||
} else if (Utils.isSystemMessage(post)) {
|
} else if (Utils.isSystemMessage(post)) {
|
||||||
src = Constants.SYSTEM_MESSAGE_PROFILE_IMAGE;
|
src = Constants.SYSTEM_MESSAGE_PROFILE_IMAGE;
|
||||||
|
|||||||
@@ -173,24 +173,15 @@ export default class PostsView extends React.Component {
|
|||||||
const postFromWebhook = Boolean(post.props && post.props.from_webhook);
|
const postFromWebhook = Boolean(post.props && post.props.from_webhook);
|
||||||
const prevPostFromWebhook = Boolean(prevPost.props && prevPost.props.from_webhook);
|
const prevPostFromWebhook = Boolean(prevPost.props && prevPost.props.from_webhook);
|
||||||
const prevPostUserId = Utils.isSystemMessage(prevPost) ? '' : prevPost.user_id;
|
const prevPostUserId = Utils.isSystemMessage(prevPost) ? '' : prevPost.user_id;
|
||||||
let prevWebhookName = '';
|
|
||||||
if (prevPost.props && prevPost.props.override_username) {
|
|
||||||
prevWebhookName = prevPost.props.override_username;
|
|
||||||
}
|
|
||||||
let curWebhookName = '';
|
|
||||||
if (post.props && post.props.override_username) {
|
|
||||||
curWebhookName = post.props.override_username;
|
|
||||||
}
|
|
||||||
|
|
||||||
// consider posts from the same user if:
|
// consider posts from the same user if:
|
||||||
// the previous post was made by the same user as the current post,
|
// the previous post was made by the same user as the current post,
|
||||||
// the previous post was made within 5 minutes of the current post,
|
// the previous post was made within 5 minutes of the current post,
|
||||||
// the previous post and current post are both from webhooks or both not,
|
// the current post is not from a webhook
|
||||||
// the previous post and current post have the same webhook usernames
|
// the previous post is not from a webhook
|
||||||
if (prevPostUserId === postUserId &&
|
if (prevPostUserId === postUserId &&
|
||||||
post.create_at - prevPost.create_at <= 1000 * 60 * 5 &&
|
post.create_at - prevPost.create_at <= 1000 * 60 * 5 &&
|
||||||
postFromWebhook === prevPostFromWebhook &&
|
!postFromWebhook && !prevPostFromWebhook) {
|
||||||
prevWebhookName === curWebhookName) {
|
|
||||||
sameUser = true;
|
sameUser = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,13 +204,11 @@ export default class PostsView extends React.Component {
|
|||||||
// the previous post was made by the same user as the current post,
|
// the previous post was made by the same user as the current post,
|
||||||
// the previous post is not a comment,
|
// the previous post is not a comment,
|
||||||
// the current post is not a comment,
|
// the current post is not a comment,
|
||||||
// the previous post and current post are both from webhooks or both not,
|
// the current post is not from a webhook
|
||||||
// the previous post and current post have the same webhook usernames
|
|
||||||
if (prevPostUserId === postUserId &&
|
if (prevPostUserId === postUserId &&
|
||||||
!prevPostIsComment &&
|
!prevPostIsComment &&
|
||||||
!postIsComment &&
|
!postIsComment &&
|
||||||
postFromWebhook === prevPostFromWebhook &&
|
!postFromWebhook) {
|
||||||
prevWebhookName === curWebhookName) {
|
|
||||||
hideProfilePic = true;
|
hideProfilePic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,6 +217,8 @@ export default class RhsRootPost extends React.Component {
|
|||||||
if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
|
if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
|
||||||
if (post.props.override_icon_url) {
|
if (post.props.override_icon_url) {
|
||||||
src = post.props.override_icon_url;
|
src = post.props.override_icon_url;
|
||||||
|
} else {
|
||||||
|
src = Constants.DEFAULT_WEBHOOK_LOGO;
|
||||||
}
|
}
|
||||||
} else if (Utils.isSystemMessage(post)) {
|
} else if (Utils.isSystemMessage(post)) {
|
||||||
src = Constants.SYSTEM_MESSAGE_PROFILE_IMAGE;
|
src = Constants.SYSTEM_MESSAGE_PROFILE_IMAGE;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import patchIcon from 'images/icons/patch.png';
|
|||||||
import genericIcon from 'images/icons/generic.png';
|
import genericIcon from 'images/icons/generic.png';
|
||||||
|
|
||||||
import logoImage from 'images/logo_compact.png';
|
import logoImage from 'images/logo_compact.png';
|
||||||
|
import logoWebhook from 'images/webhook_icon.jpg';
|
||||||
|
|
||||||
import solarizedDarkCSS from '!!file?name=files/code_themes/[hash].[ext]!highlight.js/styles/solarized-dark.css';
|
import solarizedDarkCSS from '!!file?name=files/code_themes/[hash].[ext]!highlight.js/styles/solarized-dark.css';
|
||||||
import solarizedDarkIcon from 'images/themes/code_themes/solarized-dark.png';
|
import solarizedDarkIcon from 'images/themes/code_themes/solarized-dark.png';
|
||||||
@@ -617,5 +618,6 @@ export default {
|
|||||||
MAX_PASSWORD_LENGTH: 50,
|
MAX_PASSWORD_LENGTH: 50,
|
||||||
TIME_SINCE_UPDATE_INTERVAL: 30000,
|
TIME_SINCE_UPDATE_INTERVAL: 30000,
|
||||||
MIN_HASHTAG_LINK_LENGTH: 3,
|
MIN_HASHTAG_LINK_LENGTH: 3,
|
||||||
EMOJI_PATH: '/static/emoji'
|
EMOJI_PATH: '/static/emoji',
|
||||||
|
DEFAULT_WEBHOOK_LOGO: logoWebhook
|
||||||
};
|
};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user