diff --git a/webapp/src/actions/index.js b/webapp/src/actions/index.js index c521a05..6c6e423 100644 --- a/webapp/src/actions/index.js +++ b/webapp/src/actions/index.js @@ -1,3 +1,5 @@ +import {getCustomEmojisInText} from 'mattermost-redux/actions/emojis'; + import Client from '../client'; import ActionTypes from '../action_types'; import {id as pluginId} from '../manifest'; @@ -11,7 +13,7 @@ export function getAttributes(userID = '') { return {}; } - let data; + let data = []; try { data = await Client.getAttributes(userID); } catch (error) { @@ -27,6 +29,8 @@ export function getAttributes(userID = '') { return {error}; } + data.forEach((attribute) => dispatch(getCustomEmojisInText(attribute))); + dispatch({ type: ActionTypes.RECEIVED_ATTRIBUTES, userID, @@ -37,4 +41,4 @@ export function getAttributes(userID = '') { return {data}; }; -} \ No newline at end of file +} diff --git a/webapp/src/components/admin_settings/custom_attribute/custom_attribute.jsx b/webapp/src/components/admin_settings/custom_attribute/custom_attribute.jsx index 24fdad2..4a489ca 100644 --- a/webapp/src/components/admin_settings/custom_attribute/custom_attribute.jsx +++ b/webapp/src/components/admin_settings/custom_attribute/custom_attribute.jsx @@ -17,6 +17,7 @@ export default class CustomAttribute extends React.Component { onChange: PropTypes.func.isRequired, actions: PropTypes.shape({ getProfilesByIds: PropTypes.func.isRequired, + getCustomEmojisInText: PropTypes.func.isRequired, }).isRequired, } @@ -105,6 +106,8 @@ export default class CustomAttribute extends React.Component { return null; } + this.props.actions.getCustomEmojisInText(this.state.name); + const formattedText = formatText(this.state.name); return messageHtmlToComponent(formattedText); } diff --git a/webapp/src/components/admin_settings/custom_attribute/index.jsx b/webapp/src/components/admin_settings/custom_attribute/index.jsx index e0078d8..3fe662c 100644 --- a/webapp/src/components/admin_settings/custom_attribute/index.jsx +++ b/webapp/src/components/admin_settings/custom_attribute/index.jsx @@ -1,5 +1,6 @@ import {connect} from 'react-redux'; import {bindActionCreators} from 'redux'; +import {getCustomEmojisInText} from 'mattermost-redux/actions/emojis'; import {getProfilesByIds} from 'mattermost-redux/actions/users'; @@ -9,6 +10,7 @@ function mapDispatchToProps(dispatch) { return { actions: bindActionCreators({ getProfilesByIds, + getCustomEmojisInText, }, dispatch), }; }