diff --git a/app/constants/settings.js b/app/constants/settings.js index 8c0d55779..14ad8fb36 100644 --- a/app/constants/settings.js +++ b/app/constants/settings.js @@ -26,9 +26,6 @@ export default { Accounts_CustomFields: { type: 'valueAsString' }, - Accounts_Default_User_Preferences_enableMessageParserEarlyAdoption: { - type: 'valueAsBoolean' - }, Accounts_EmailOrUsernamePlaceholder: { type: 'valueAsString' }, diff --git a/app/lib/database/model/Message.js b/app/lib/database/model/Message.js index 5904c2076..4dcecb30d 100644 --- a/app/lib/database/model/Message.js +++ b/app/lib/database/model/Message.js @@ -84,5 +84,5 @@ export default class Message extends Model { @field('tshow') tshow; - @field('md') md; + @json('md', sanitizer) md; } diff --git a/app/lib/methods/sendMessage.js b/app/lib/methods/sendMessage.js index 9b1bc6d10..466c9a3e0 100644 --- a/app/lib/methods/sendMessage.js +++ b/app/lib/methods/sendMessage.js @@ -20,6 +20,10 @@ const changeMessageStatus = async(id, tmid, status, message) => { m.mentions = message.mentions; m.channels = message.channels; } + + if (message.md) { + m.md = message.md; + } }) ); diff --git a/app/views/ProfileView/index.js b/app/views/ProfileView/index.js index 68d825c93..c2d061615 100644 --- a/app/views/ProfileView/index.js +++ b/app/views/ProfileView/index.js @@ -57,7 +57,6 @@ class ProfileView extends React.Component { Accounts_AllowRealNameChange: PropTypes.bool, Accounts_AllowUserAvatarChange: PropTypes.bool, Accounts_AllowUsernameChange: PropTypes.bool, - Accounts_enableMessageParserEarlyAdoption: PropTypes.bool, Accounts_CustomFields: PropTypes.string, setUser: PropTypes.func, theme: PropTypes.string @@ -74,8 +73,7 @@ class ProfileView extends React.Component { avatarUrl: null, avatar: {}, avatarSuggestions: {}, - customFields: {}, - preferences: [] + customFields: {} }; async componentDidMount() { @@ -112,15 +110,12 @@ class ProfileView extends React.Component { this.setState({ avatar }); } - init = async(user) => { + init = (user) => { const { user: userProps } = this.props; const { - name, username, emails, customFields, id + name, username, emails, customFields, enableMessageParserEarlyAdoption } = user || userProps; - const result = await RocketChat.getUserPreferences(id); - const { preferences } = result; - this.setState({ name, username, @@ -130,14 +125,13 @@ class ProfileView extends React.Component { avatarUrl: null, avatar: {}, customFields: customFields || {}, - enableMessageParser: preferences?.enableMessageParserEarlyAdoption || false, - preferences + enableMessageParser: enableMessageParserEarlyAdoption || false }); } formIsChanged = () => { const { - name, username, email, newPassword, avatar, customFields, enableMessageParser, preferences + name, username, email, newPassword, avatar, customFields, enableMessageParser } = this.state; const { user } = this.props; let customFieldsChanged = false; @@ -153,7 +147,7 @@ class ProfileView extends React.Component { return !(user.name === name && user.username === username - && preferences.enableMessageParserEarlyAdoption === enableMessageParser + && user.enableMessageParserEarlyAdoption === enableMessageParser && !newPassword && (user.emails && user.emails[0].address === email) && !avatar.data @@ -480,8 +474,7 @@ class ProfileView extends React.Component { Accounts_AllowRealNameChange, Accounts_AllowUserAvatarChange, Accounts_AllowUsernameChange, - Accounts_CustomFields, - Accounts_enableMessageParserEarlyAdoption + Accounts_CustomFields } = this.props; return ( @@ -568,14 +561,11 @@ class ProfileView extends React.Component { theme={theme} /> - {Accounts_enableMessageParserEarlyAdoption - ? ( - this.renderMessageParserSwitch()} - /> - ) : null} + this.renderMessageParserSwitch()} + /> {this.renderCustomFields()} ({ Accounts_AllowUserAvatarChange: state.settings.Accounts_AllowUserAvatarChange, Accounts_AllowUsernameChange: state.settings.Accounts_AllowUsernameChange, Accounts_CustomFields: state.settings.Accounts_CustomFields, - Accounts_enableMessageParserEarlyAdoption: state.settings.Accounts_Default_User_Preferences_enableMessageParserEarlyAdoption, baseUrl: state.server.server });