diff options
-rw-r--r-- | api/file.go | 5 | ||||
-rw-r--r-- | api/post.go | 2 | ||||
-rw-r--r-- | i18n/en.json | 4 | ||||
-rw-r--r-- | webapp/components/admin_console/service_settings.jsx | 5 | ||||
-rw-r--r-- | webapp/components/logged_in.jsx | 5 | ||||
-rw-r--r-- | webapp/components/post.jsx | 2 | ||||
-rw-r--r-- | webapp/components/posts_view.jsx | 21 | ||||
-rw-r--r-- | webapp/components/rhs_root_post.jsx | 2 | ||||
-rw-r--r-- | webapp/utils/constants.jsx | 4 |
9 files changed, 29 insertions, 21 deletions
diff --git a/api/file.go b/api/file.go index 9150e4bfe..f0873f884 100644 --- a/api/file.go +++ b/api/file.go @@ -394,6 +394,11 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) { getFileAndForget(path, fileData) if len(hash) > 0 && len(data) > 0 && len(teamId) == 26 { + if !utils.Cfg.FileSettings.EnablePublicLink { + c.Err = model.NewLocAppError("getFile", "api.file.get_file.public_disabled.app_error", nil, "") + return + } + if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", data, utils.Cfg.FileSettings.PublicLinkSalt)) { c.Err = model.NewLocAppError("getFile", "api.file.get_file.public_invalid.app_error", nil, "") return diff --git a/api/post.go b/api/post.go index 36fd4ee79..2fe5feb8e 100644 --- a/api/post.go +++ b/api/post.go @@ -172,8 +172,6 @@ func CreateWebhookPost(c *Context, channelId, text, overrideUsername, overrideIc if utils.Cfg.ServiceSettings.EnablePostIconOverride { if len(overrideIconUrl) != 0 { post.AddProp("override_icon_url", overrideIconUrl) - } else { - post.AddProp("override_icon_url", model.DEFAULT_WEBHOOK_ICON) } } diff --git a/i18n/en.json b/i18n/en.json index 40bce082c..7dcc351f1 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -476,6 +476,10 @@ "translation": "Could not find file." }, { + "id": "api.file.get_file.public_disabled.app_error", + "translation": "Public links have been disabled by the system administrator" + }, + { "id": "api.file.get_file.public_invalid.app_error", "translation": "The public link does not appear to be valid" }, diff --git a/webapp/components/admin_console/service_settings.jsx b/webapp/components/admin_console/service_settings.jsx index 41ea5ea34..c72c97326 100644 --- a/webapp/components/admin_console/service_settings.jsx +++ b/webapp/components/admin_console/service_settings.jsx @@ -84,10 +84,13 @@ class ServiceSettings extends React.Component { config.ServiceSettings.EnableDeveloper = ReactDOM.findDOMNode(this.refs.EnableDeveloper).checked; config.ServiceSettings.EnableSecurityFixAlert = ReactDOM.findDOMNode(this.refs.EnableSecurityFixAlert).checked; config.ServiceSettings.EnableInsecureOutgoingConnections = ReactDOM.findDOMNode(this.refs.EnableInsecureOutgoingConnections).checked; - config.ServiceSettings.EnableMultifactorAuthentication = ReactDOM.findDOMNode(this.refs.EnableMultifactorAuthentication).checked; config.ServiceSettings.EnableCommands = ReactDOM.findDOMNode(this.refs.EnableCommands).checked; config.ServiceSettings.EnableOnlyAdminIntegrations = ReactDOM.findDOMNode(this.refs.EnableOnlyAdminIntegrations).checked; + if (this.refs.EnablMultifactorAuthentication) { + config.ServiceSettings.EnableMultifactorAuthentication = ReactDOM.findDOMNode(this.refs.EnableMultifactorAuthentication).checked; + } + //config.ServiceSettings.EnableOAuthServiceProvider = ReactDOM.findDOMNode(this.refs.EnableOAuthServiceProvider).checked; var MaximumLoginAttempts = DefaultMaximumLoginAttempts; diff --git a/webapp/components/logged_in.jsx b/webapp/components/logged_in.jsx index f7a6be647..3b44f5940 100644 --- a/webapp/components/logged_in.jsx +++ b/webapp/components/logged_in.jsx @@ -266,7 +266,10 @@ LoggedIn.defaultProps = { }; LoggedIn.propTypes = { - children: React.PropTypes.arrayOf(React.PropTypes.element), + children: React.PropTypes.oneOfType([ + React.PropTypes.arrayOf(React.PropTypes.element), + React.PropTypes.element + ]), navbar: React.PropTypes.element, sidebar: React.PropTypes.element, center: React.PropTypes.element, diff --git a/webapp/components/post.jsx b/webapp/components/post.jsx index f2818188a..30c47ee22 100644 --- a/webapp/components/post.jsx +++ b/webapp/components/post.jsx @@ -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.override_icon_url) { src = post.props.override_icon_url; + } else { + src = Constants.DEFAULT_WEBHOOK_LOGO; } } else if (Utils.isSystemMessage(post)) { src = Constants.SYSTEM_MESSAGE_PROFILE_IMAGE; diff --git a/webapp/components/posts_view.jsx b/webapp/components/posts_view.jsx index 647c7f086..af849fc4a 100644 --- a/webapp/components/posts_view.jsx +++ b/webapp/components/posts_view.jsx @@ -173,24 +173,15 @@ export default class PostsView extends React.Component { const postFromWebhook = Boolean(post.props && post.props.from_webhook); const prevPostFromWebhook = Boolean(prevPost.props && prevPost.props.from_webhook); 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: // 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 and current post are both from webhooks or both not, - // the previous post and current post have the same webhook usernames + // the current post is not from a webhook + // the previous post is not from a webhook if (prevPostUserId === postUserId && post.create_at - prevPost.create_at <= 1000 * 60 * 5 && - postFromWebhook === prevPostFromWebhook && - prevWebhookName === curWebhookName) { + !postFromWebhook && !prevPostFromWebhook) { 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 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 previous post and current post have the same webhook usernames + // the current post is not from a webhook if (prevPostUserId === postUserId && !prevPostIsComment && !postIsComment && - postFromWebhook === prevPostFromWebhook && - prevWebhookName === curWebhookName) { + !postFromWebhook) { hideProfilePic = true; } } diff --git a/webapp/components/rhs_root_post.jsx b/webapp/components/rhs_root_post.jsx index 26b392aa1..7a7c5f692 100644 --- a/webapp/components/rhs_root_post.jsx +++ b/webapp/components/rhs_root_post.jsx @@ -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.override_icon_url) { src = post.props.override_icon_url; + } else { + src = Constants.DEFAULT_WEBHOOK_LOGO; } } else if (Utils.isSystemMessage(post)) { src = Constants.SYSTEM_MESSAGE_PROFILE_IMAGE; diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index 421a46860..68df771f9 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -14,6 +14,7 @@ import patchIcon from 'images/icons/patch.png'; import genericIcon from 'images/icons/generic.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 solarizedDarkIcon from 'images/themes/code_themes/solarized-dark.png'; @@ -617,5 +618,6 @@ export default { MAX_PASSWORD_LENGTH: 50, TIME_SINCE_UPDATE_INTERVAL: 30000, MIN_HASHTAG_LINK_LENGTH: 3, - EMOJI_PATH: '/static/emoji' + EMOJI_PATH: '/static/emoji', + DEFAULT_WEBHOOK_LOGO: logoWebhook }; |