From 7ce75755491f964d5679ff617297623480621c5a Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 25 Nov 2019 01:42:51 +0100 Subject: [Glitch] Fix OCR with delete & redraft Port e7a7f88df7a763be6dad3a982829ef5a1b1dea09 to glitch-soc Signed-off-by: Thibaut Girka --- .../flavours/glitch/features/ui/components/focal_point_modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/javascript/flavours') diff --git a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js index 2846d53d7..77e4bbfa5 100644 --- a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js @@ -214,7 +214,7 @@ class FocalPointModal extends ImmutablePureComponent { langPath: `${assetHost}/ocr/lang-data`, }); - let media_url = media.get('file'); + let media_url = media.get('url'); if (window.URL && URL.createObjectURL) { try { -- cgit From 949b37faba4cfcefc8347432f3d55ac11452d7eb Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 29 Nov 2019 17:02:18 +0100 Subject: [Glitch] Fix pending upload count not being decremented on error Port 667708f5b00ee8b7795eacd9c20d29f77c8ae602 to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/actions/compose.js | 5 ++--- app/javascript/flavours/glitch/reducers/compose.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'app/javascript/flavours') diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index 7182ed0fa..f80642bd8 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -263,7 +263,7 @@ export function uploadCompose(files) { dispatch(uploadComposeProgress(progress.reduce((a, v) => a + v, 0), total)); }, }).then(({ data }) => dispatch(uploadComposeSuccess(data, f))); - }).catch(error => dispatch(uploadComposeFail(error, true))); + }).catch(error => dispatch(uploadComposeFail(error))); }; }; }; @@ -294,11 +294,10 @@ export function changeUploadComposeSuccess(media) { }; }; -export function changeUploadComposeFail(error, decrement = false) { +export function changeUploadComposeFail(error) { return { type: COMPOSE_UPLOAD_CHANGE_FAIL, error: error, - decrement: decrement, skipLoading: true, }; }; diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index ac826de2b..0f807790b 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -429,7 +429,7 @@ export default function compose(state = initialState, action) { case COMPOSE_UPLOAD_SUCCESS: return appendMedia(state, fromJS(action.media), action.file); case COMPOSE_UPLOAD_FAIL: - return state.set('is_uploading', false).update('pending_media_attachments', n => action.decrement ? n - 1 : n); + return state.set('is_uploading', false).update('pending_media_attachments', n => n - 1); case COMPOSE_UPLOAD_UNDO: return removeMedia(state, action.media_id); case COMPOSE_UPLOAD_PROGRESS: -- cgit From 776352d329f773a45ecd5c36a381812fd2f9839f Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 29 Nov 2019 17:02:36 +0100 Subject: [Glitch] Add hotkey for opening media files Port a690b3e470ed85cc6f3f8fa7aec57d04b60a4705 to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/components/status.js | 17 +++++++++++++++++ .../glitch/features/keyboard_shortcuts/index.js | 4 ++++ app/javascript/flavours/glitch/features/status/index.js | 17 +++++++++++++++++ app/javascript/flavours/glitch/features/ui/index.js | 1 + app/javascript/flavours/glitch/features/video/index.js | 2 +- 5 files changed, 40 insertions(+), 1 deletion(-) (limited to 'app/javascript/flavours') diff --git a/app/javascript/flavours/glitch/components/status.js b/app/javascript/flavours/glitch/components/status.js index e7bf1f4d0..23cdc0167 100644 --- a/app/javascript/flavours/glitch/components/status.js +++ b/app/javascript/flavours/glitch/components/status.js @@ -376,6 +376,22 @@ class Status extends ImmutablePureComponent { this.props.onOpenVideo(media, startTime); } + handleHotkeyOpenMedia = e => { + const { status, onOpenMedia, onOpenVideo } = this.props; + + e.preventDefault(); + + if (status.get('media_attachments').size > 0) { + if (status.getIn(['media_attachments', 0, 'type']) === 'audio') { + // TODO: toggle play/paused? + } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { + onOpenVideo(status.getIn(['media_attachments', 0]), 0); + } else { + onOpenMedia(status.get('media_attachments'), 0); + } + } + } + handleHotkeyReply = e => { e.preventDefault(); this.props.onReply(this.props.status, this.context.router.history); @@ -503,6 +519,7 @@ class Status extends ImmutablePureComponent { bookmark: this.handleHotkeyBookmark, toggleCollapse: this.handleHotkeyCollapse, toggleSensitive: this.handleHotkeyToggleSensitive, + openMedia: this.handleHotkeyOpenMedia, }; if (hidden) { diff --git a/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.js b/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.js index e40dbf44e..bc7571200 100644 --- a/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.js +++ b/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.js @@ -67,6 +67,10 @@ class KeyboardShortcuts extends ImmutablePureComponent { enter, o + + e + + x diff --git a/app/javascript/flavours/glitch/features/status/index.js b/app/javascript/flavours/glitch/features/status/index.js index 508510c4e..322f92477 100644 --- a/app/javascript/flavours/glitch/features/status/index.js +++ b/app/javascript/flavours/glitch/features/status/index.js @@ -320,6 +320,22 @@ class Status extends ImmutablePureComponent { this.props.dispatch(openModal('VIDEO', { media, time })); } + handleHotkeyOpenMedia = e => { + const { status } = this.props; + + e.preventDefault(); + + if (status.get('media_attachments').size > 0) { + if (status.getIn(['media_attachments', 0, 'type']) === 'audio') { + // TODO: toggle play/paused? + } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { + this.handleOpenVideo(status.getIn(['media_attachments', 0]), 0); + } else { + this.handleOpenMedia(status.get('media_attachments'), 0); + } + } + } + handleMuteClick = (account) => { this.props.dispatch(initMuteModal(account)); } @@ -529,6 +545,7 @@ class Status extends ImmutablePureComponent { openProfile: this.handleHotkeyOpenProfile, toggleSpoiler: this.handleExpandedToggle, toggleSensitive: this.handleHotkeyToggleSensitive, + openMedia: this.handleHotkeyOpenMedia, }; return ( diff --git a/app/javascript/flavours/glitch/features/ui/index.js b/app/javascript/flavours/glitch/features/ui/index.js index 7d6c5f613..5c861fdee 100644 --- a/app/javascript/flavours/glitch/features/ui/index.js +++ b/app/javascript/flavours/glitch/features/ui/index.js @@ -107,6 +107,7 @@ const keyMap = { bookmark: 'd', toggleCollapse: 'shift+x', toggleSensitive: 'h', + openMedia: 'e', }; class SwitchingColumnsArea extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/features/video/index.js b/app/javascript/flavours/glitch/features/video/index.js index 39dab7ec7..049baaee7 100644 --- a/app/javascript/flavours/glitch/features/video/index.js +++ b/app/javascript/flavours/glitch/features/video/index.js @@ -488,7 +488,7 @@ class Video extends React.PureComponent {
- +
  -- cgit From b509b8812a8f08f59f3b0303f7d8e98de86e3590 Mon Sep 17 00:00:00 2001 From: Sasha Sorokin Date: Fri, 29 Nov 2019 23:03:38 +0700 Subject: [Glitch] Fix counter sizing Port b532ead798c481fd03be9eb78e910d62654cdaa8 to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/styles/containers.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/javascript/flavours') diff --git a/app/javascript/flavours/glitch/styles/containers.scss b/app/javascript/flavours/glitch/styles/containers.scss index e2f291b69..d1c6c33d7 100644 --- a/app/javascript/flavours/glitch/styles/containers.scss +++ b/app/javascript/flavours/glitch/styles/containers.scss @@ -652,7 +652,7 @@ } .counter { - width: 33.3%; + min-width: 33.3%; box-sizing: border-box; flex: 0 0 auto; color: $darker-text-color; -- cgit