From 1a33759e1911de8e1a5ac6dfe427509efc9d0174 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Tue, 31 Mar 2020 12:04:50 -0400 Subject: [PATCH] Progress --- app/javascript/gabsocial/actions/compose.js | 28 +- app/javascript/gabsocial/assets/donor_icon.js | 26 ++ app/javascript/gabsocial/assets/gab_logo.js | 8 +- .../gabsocial/assets/investor_icon.js | 26 ++ app/javascript/gabsocial/assets/pro_icon.js | 26 ++ .../autosuggest_textbox.js | 20 +- .../gabsocial/components/composer.js | 299 +++++++++++++++++- .../gabsocial/components/display_name.js | 25 +- app/javascript/gabsocial/components/icon.js | 8 + .../gabsocial/components/link_footer.js | 2 +- .../components/modal/leaving_gab_modal.js | 27 ++ .../components/panel/profile_info_panel.js | 4 +- .../popover/remote_user_info_popover.js | 63 ++++ .../popover/status_options_popover.js | 32 +- .../gabsocial/components/sidebar.js | 2 +- .../gabsocial/components/sidebar_header.js | 16 +- .../components/sidebar_section_item.js | 21 +- .../components/status_action_bar_item.js | 2 +- .../gabsocial/components/status_card.js | 4 +- .../status_content/status_content.js | 29 +- app/javascript/gabsocial/components/text.js | 2 + .../components/timeline_compose_block.js | 11 +- app/javascript/gabsocial/components/video.js | 2 +- .../components/compose_form/compose_form.js | 21 +- .../components/reply_indicator/index.js | 1 - .../reply_indicator/reply_indicator.js | 64 ---- .../reply_indicator/reply_indicator.scss | 137 -------- .../containers/reply_indicator_container.js | 23 -- .../features/compose/util/url_regex.js | 4 +- app/javascript/gabsocial/reducers/compose.js | 4 + app/javascript/styles/global.css | 16 + app/lib/formatter.rb | 10 +- app/lib/sanitize_config.rb | 2 +- spec/fixtures/xml/gabsocial.atom | 4 +- spec/services/fetch_link_card_service_spec.rb | 2 +- spec/services/verify_link_service_spec.rb | 4 +- yarn.lock | 134 +------- 37 files changed, 651 insertions(+), 458 deletions(-) create mode 100644 app/javascript/gabsocial/assets/donor_icon.js create mode 100644 app/javascript/gabsocial/assets/investor_icon.js create mode 100644 app/javascript/gabsocial/assets/pro_icon.js create mode 100644 app/javascript/gabsocial/components/modal/leaving_gab_modal.js create mode 100644 app/javascript/gabsocial/components/popover/remote_user_info_popover.js delete mode 100644 app/javascript/gabsocial/features/compose/components/reply_indicator/index.js delete mode 100644 app/javascript/gabsocial/features/compose/components/reply_indicator/reply_indicator.js delete mode 100644 app/javascript/gabsocial/features/compose/components/reply_indicator/reply_indicator.scss delete mode 100644 app/javascript/gabsocial/features/compose/containers/reply_indicator_container.js diff --git a/app/javascript/gabsocial/actions/compose.js b/app/javascript/gabsocial/actions/compose.js index 620ad4ed..43c5673a 100644 --- a/app/javascript/gabsocial/actions/compose.js +++ b/app/javascript/gabsocial/actions/compose.js @@ -3,6 +3,7 @@ import { CancelToken, isCancel } from 'axios'; import { throttle } from 'lodash'; import moment from 'moment'; import { search as emojiSearch } from '../components/emoji/emoji_mart_search_light'; +import { urlRegex } from '../features/compose/util/url_regex' import { tagHistory } from '../settings'; import { useEmoji } from './emojis'; import resizeImage from '../utils/resize_image'; @@ -62,6 +63,8 @@ export const COMPOSE_POLL_SETTINGS_CHANGE = 'COMPOSE_POLL_SETTINGS_CHANGE'; export const COMPOSE_SCHEDULED_AT_CHANGE = 'COMPOSE_SCHEDULED_AT_CHANGE'; +export const COMPOSE_RICH_TEXT_EDITOR_CONTROLS_VISIBILITY = 'COMPOSE_RICH_TEXT_EDITOR_CONTROLS_VISIBILITY' + const messages = defineMessages({ uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' }, uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' }, @@ -170,12 +173,20 @@ export function submitCompose(routerHistory, group) { return function (dispatch, getState) { if (!me) return; - const status = getState().getIn(['compose', 'text'], ''); + let status = getState().getIn(['compose', 'text'], ''); + let statusMarkdown = getState().getIn(['compose', 'text_markdown'], ''); const media = getState().getIn(['compose', 'media_attachments']); - if ((!status || !status.length) && media.size === 0) { - return; - } + // : hack : + //Prepend http:// to urls in status that don't have protocol + status = status.replace(urlRegex, (match) =>{ + const hasProtocol = match.startsWith('https://') || match.startsWith('http://') + return hasProtocol ? match : `http://${match}` + }) + statusMarkdown = statusMarkdown.replace(urlRegex, (match) =>{ + const hasProtocol = match.startsWith('https://') || match.startsWith('http://') + return hasProtocol ? match : `http://${match}` + }) dispatch(submitComposeRequest()); dispatch(closeModal()); @@ -191,6 +202,7 @@ export function submitCompose(routerHistory, group) { api(getState)[method](endpoint, { status, + statusMarkdown, scheduled_at, in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null), quote_of_id: getState().getIn(['compose', 'quote_of_id'], null), @@ -593,4 +605,10 @@ export function changeScheduledAt(date) { type: COMPOSE_SCHEDULED_AT_CHANGE, date, }; -}; \ No newline at end of file +}; + +export function changeRichTextEditorControlsVisibility() { + return { + type: COMPOSE_RICH_TEXT_EDITOR_CONTROLS_VISIBILITY, + } +} \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/donor_icon.js b/app/javascript/gabsocial/assets/donor_icon.js new file mode 100644 index 00000000..de574f3e --- /dev/null +++ b/app/javascript/gabsocial/assets/donor_icon.js @@ -0,0 +1,26 @@ +const DonorIcon = ({ + className = '', + width = '24px', + height = '24px', + viewBox = '0 0 24 24', + title = 'Gab.com Donor', +}) => ( + + + + + +) + +export default DonorIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/gab_logo.js b/app/javascript/gabsocial/assets/gab_logo.js index 8fc21415..293e70c7 100644 --- a/app/javascript/gabsocial/assets/gab_logo.js +++ b/app/javascript/gabsocial/assets/gab_logo.js @@ -1,9 +1,11 @@ const GabLogo = ({ + className = _s.fillColorBrand, width = '50px', height = '30px', viewBox = '0 0 50 30' }) => ( - - - diff --git a/app/javascript/gabsocial/assets/investor_icon.js b/app/javascript/gabsocial/assets/investor_icon.js new file mode 100644 index 00000000..ed4da684 --- /dev/null +++ b/app/javascript/gabsocial/assets/investor_icon.js @@ -0,0 +1,26 @@ +const InvestorIcon = ({ + className = '', + width = '24px', + height = '24px', + viewBox = '0 0 24 24', + title = 'Gab.com Investor', +}) => ( + + + + + +) + +export default InvestorIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/pro_icon.js b/app/javascript/gabsocial/assets/pro_icon.js new file mode 100644 index 00000000..326900e6 --- /dev/null +++ b/app/javascript/gabsocial/assets/pro_icon.js @@ -0,0 +1,26 @@ +const ProIcon = ({ + className = '', + width = '24px', + height = '24px', + viewBox = '0 0 24 24', + title = 'GabPRO Account', +}) => ( + + + + + +) + +export default ProIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/components/autosuggest_textbox/autosuggest_textbox.js b/app/javascript/gabsocial/components/autosuggest_textbox/autosuggest_textbox.js index 602588a9..637fd5a4 100644 --- a/app/javascript/gabsocial/components/autosuggest_textbox/autosuggest_textbox.js +++ b/app/javascript/gabsocial/components/autosuggest_textbox/autosuggest_textbox.js @@ -253,10 +253,21 @@ export default class AutosuggestTextbox extends ImmutablePureComponent {
- {/**/} + -