From c583e0c8f5b43d898c7687b19ee471258b403143 Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Thu, 27 Feb 2020 15:34:20 -0300 Subject: [PATCH] [IMPROVEMENT] Remove useMarkdown (#1774) Co-authored-by: Diego Mello --- app/actions/actionsTypes.js | 1 - app/actions/markdown.js | 8 ------ app/containers/MessageBox/ReplyPreview.js | 5 +--- app/containers/markdown/index.js | 9 +------ app/containers/message/Attachments.js | 11 ++++---- app/containers/message/Audio.js | 5 ++-- app/containers/message/Content.js | 2 -- app/containers/message/Image.js | 5 ++-- app/containers/message/Reply.js | 8 ++---- app/containers/message/Video.js | 5 ++-- app/containers/message/index.js | 4 +-- app/i18n/locales/de.js | 1 - app/i18n/locales/en.js | 1 - app/i18n/locales/es-ES.js | 1 - app/i18n/locales/it.js | 1 - app/i18n/locales/nl.js | 1 - app/i18n/locales/pt-BR.js | 1 - app/i18n/locales/ru.js | 1 - app/lib/rocketchat.js | 8 ------ app/reducers/index.js | 2 -- app/reducers/markdown.js | 17 ------------- app/sagas/init.js | 4 --- app/views/RoomInfoView/index.js | 1 - app/views/RoomView/index.js | 7 +---- app/views/SettingsView/index.js | 31 +---------------------- e2e/14-setting.spec.js | 4 --- 26 files changed, 18 insertions(+), 126 deletions(-) delete mode 100644 app/actions/markdown.js delete mode 100644 app/reducers/markdown.js diff --git a/app/actions/actionsTypes.js b/app/actions/actionsTypes.js index ad8964391..8fda57def 100644 --- a/app/actions/actionsTypes.js +++ b/app/actions/actionsTypes.js @@ -50,7 +50,6 @@ export const SNIPPETED_MESSAGES = createRequestTypes('SNIPPETED_MESSAGES', ['OPE export const DEEP_LINKING = createRequestTypes('DEEP_LINKING', ['OPEN']); export const SORT_PREFERENCES = createRequestTypes('SORT_PREFERENCES', ['SET_ALL', 'SET']); export const NOTIFICATION = createRequestTypes('NOTIFICATION', ['RECEIVED', 'REMOVE']); -export const TOGGLE_MARKDOWN = 'TOGGLE_MARKDOWN'; export const TOGGLE_CRASH_REPORT = 'TOGGLE_CRASH_REPORT'; export const SET_CUSTOM_EMOJIS = 'SET_CUSTOM_EMOJIS'; export const SET_ACTIVE_USERS = 'SET_ACTIVE_USERS'; diff --git a/app/actions/markdown.js b/app/actions/markdown.js deleted file mode 100644 index d33075a38..000000000 --- a/app/actions/markdown.js +++ /dev/null @@ -1,8 +0,0 @@ -import * as types from './actionsTypes'; - -export function toggleMarkdown(value) { - return { - type: types.TOGGLE_MARKDOWN, - payload: value - }; -} diff --git a/app/containers/MessageBox/ReplyPreview.js b/app/containers/MessageBox/ReplyPreview.js index 54d872ebd..a755598be 100644 --- a/app/containers/MessageBox/ReplyPreview.js +++ b/app/containers/MessageBox/ReplyPreview.js @@ -42,7 +42,7 @@ const styles = StyleSheet.create({ }); const ReplyPreview = React.memo(({ - message, Message_TimeFormat, baseUrl, username, useMarkdown, replying, getCustomEmoji, close, theme + message, Message_TimeFormat, baseUrl, username, replying, getCustomEmoji, close, theme }) => { if (!replying) { return null; @@ -67,7 +67,6 @@ const ReplyPreview = React.memo(({ username={username} getCustomEmoji={getCustomEmoji} numberOfLines={1} - useMarkdown={useMarkdown} preview theme={theme} /> @@ -79,7 +78,6 @@ const ReplyPreview = React.memo(({ ReplyPreview.propTypes = { replying: PropTypes.bool, - useMarkdown: PropTypes.bool, message: PropTypes.object.isRequired, Message_TimeFormat: PropTypes.string.isRequired, close: PropTypes.func.isRequired, @@ -90,7 +88,6 @@ ReplyPreview.propTypes = { }; const mapStateToProps = state => ({ - useMarkdown: state.markdown.useMarkdown, Message_TimeFormat: state.settings.Message_TimeFormat, baseUrl: state.server.server }); diff --git a/app/containers/markdown/index.js b/app/containers/markdown/index.js index 0a446ee4b..7e7812bed 100644 --- a/app/containers/markdown/index.js +++ b/app/containers/markdown/index.js @@ -71,7 +71,6 @@ class Markdown extends PureComponent { tmid: PropTypes.string, isEdited: PropTypes.bool, numberOfLines: PropTypes.number, - useMarkdown: PropTypes.bool, customEmojis: PropTypes.bool, useRealName: PropTypes.bool, channels: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), @@ -368,9 +367,7 @@ class Markdown extends PureComponent { } render() { - const { - msg, useMarkdown = true, numberOfLines, preview = false, theme - } = this.props; + const { msg, preview = false } = this.props; if (!msg) { return null; @@ -389,10 +386,6 @@ class Markdown extends PureComponent { return this.renderer.render(ast); } - if (!useMarkdown && !preview) { - return {m}; - } - const ast = parser.parse(m); this.isMessageContainsOnlyEmoji = isOnlyEmoji(m) && emojiCount(m) <= 3; diff --git a/app/containers/message/Attachments.js b/app/containers/message/Attachments.js index dc1f06847..cf3f6106c 100644 --- a/app/containers/message/Attachments.js +++ b/app/containers/message/Attachments.js @@ -8,7 +8,7 @@ import Video from './Video'; import Reply from './Reply'; const Attachments = React.memo(({ - attachments, timeFormat, user, baseUrl, useMarkdown, showAttachment, getCustomEmoji, theme + attachments, timeFormat, user, baseUrl, showAttachment, getCustomEmoji, theme }) => { if (!attachments || attachments.length === 0) { return null; @@ -16,17 +16,17 @@ const Attachments = React.memo(({ return attachments.map((file, index) => { if (file.image_url) { - return ; + return ; } if (file.audio_url) { - return