about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorpluralcafe-docker <git@plural.cafe>2018-12-18 01:54:54 +0000
committerpluralcafe-docker <git@plural.cafe>2018-12-18 01:54:54 +0000
commit94894b8a6ad1247306497dc8c0c47d52a8a2f72c (patch)
treedc29b7bf48c28b14beb29039731738bbc5de7392 /app/javascript
parentf290c5e2c337bb0aab82cb23653d4ff084ba8bbe (diff)
parent36d27e289177fdec5332539c94b8192022a412f2 (diff)
Merge branch 'glitch'
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/flavours/glitch/features/account_gallery/index.js2
-rw-r--r--app/javascript/flavours/glitch/features/composer/index.js8
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/embed_modal.js1
-rw-r--r--app/javascript/flavours/glitch/reducers/compose.js10
-rw-r--r--app/javascript/flavours/glitch/styles/components/index.scss15
5 files changed, 27 insertions, 9 deletions
diff --git a/app/javascript/flavours/glitch/features/account_gallery/index.js b/app/javascript/flavours/glitch/features/account_gallery/index.js
index 3f61af0e8..a5fa01444 100644
--- a/app/javascript/flavours/glitch/features/account_gallery/index.js
+++ b/app/javascript/flavours/glitch/features/account_gallery/index.js
@@ -107,7 +107,7 @@ export default class AccountGallery extends ImmutablePureComponent {
       );
     }
 
-    if (hasMore) {
+    if (hasMore && !(isLoading && medias.size === 0)) {
       loadOlder = <LoadMore visible={!isLoading} onClick={this.handleLoadOlder} />;
     }
 
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js
index 40eae1f53..a8f5a5c3c 100644
--- a/app/javascript/flavours/glitch/features/composer/index.js
+++ b/app/javascript/flavours/glitch/features/composer/index.js
@@ -81,6 +81,7 @@ function mapStateToProps (state) {
     focusDate: state.getIn(['compose', 'focusDate']),
     caretPosition: state.getIn(['compose', 'caretPosition']),
     isSubmitting: state.getIn(['compose', 'is_submitting']),
+    isChangingUpload: state.getIn(['compose', 'is_changing_upload']),
     isUploading: state.getIn(['compose', 'is_uploading']),
     layout: state.getIn(['local_settings', 'layout']),
     media: state.getIn(['compose', 'media_attachments']),
@@ -228,6 +229,7 @@ const handlers = {
       onChangeText,
       onSubmit,
       isSubmitting,
+      isChangingUpload,
       isUploading,
       media,
       anyMedia,
@@ -243,7 +245,7 @@ const handlers = {
     }
 
     // Submit disabled:
-    if (isSubmitting || isUploading || (!text.trim().length && !anyMedia)) {
+    if (isSubmitting || isUploading || isChangingUpload || (!text.trim().length && !anyMedia)) {
       return;
     }
 
@@ -386,6 +388,7 @@ class Composer extends React.Component {
       anyMedia,
       intl,
       isSubmitting,
+      isChangingUpload,
       isUploading,
       layout,
       media,
@@ -418,7 +421,7 @@ class Composer extends React.Component {
       spoilersAlwaysOn,
     } = this.props;
 
-    let disabledButton = isSubmitting || isUploading || (!text.trim().length && !anyMedia);
+    let disabledButton = isSubmitting || isUploading || isChangingUpload || (!text.trim().length && !anyMedia);
 
     return (
       <div className='composer'>
@@ -518,6 +521,7 @@ Composer.propTypes = {
   focusDate: PropTypes.instanceOf(Date),
   caretPosition: PropTypes.number,
   isSubmitting: PropTypes.bool,
+  isChangingUpload: PropTypes.bool,
   isUploading: PropTypes.bool,
   layout: PropTypes.string,
   media: ImmutablePropTypes.list,
diff --git a/app/javascript/flavours/glitch/features/ui/components/embed_modal.js b/app/javascript/flavours/glitch/features/ui/components/embed_modal.js
index f3553f4a9..bf29b0da5 100644
--- a/app/javascript/flavours/glitch/features/ui/components/embed_modal.js
+++ b/app/javascript/flavours/glitch/features/ui/components/embed_modal.js
@@ -74,6 +74,7 @@ export default class EmbedModal extends ImmutablePureComponent {
             className='embed-modal__iframe'
             frameBorder='0'
             ref={this.setIframeRef}
+            sandbox='allow-same-origin'
             title='preview'
           />
         </div>
diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js
index 0ddff707e..7281cbd61 100644
--- a/app/javascript/flavours/glitch/reducers/compose.js
+++ b/app/javascript/flavours/glitch/reducers/compose.js
@@ -67,6 +67,7 @@ const initialState = ImmutableMap({
   in_reply_to: null,
   is_submitting: false,
   is_uploading: false,
+  is_changing_upload: false,
   progress: 0,
   media_attachments: ImmutableList(),
   suggestion_token: null,
@@ -130,6 +131,7 @@ function clearAll(state) {
     map.set('spoiler', false);
     map.set('spoiler_text', '');
     map.set('is_submitting', false);
+    map.set('is_changing_upload', false);
     map.set('in_reply_to', null);
     map.update(
       'advanced_options',
@@ -341,13 +343,15 @@ export default function compose(state = initialState, action) {
       map.set('idempotencyKey', uuid());
     });
   case COMPOSE_SUBMIT_REQUEST:
-  case COMPOSE_UPLOAD_CHANGE_REQUEST:
     return state.set('is_submitting', true);
+  case COMPOSE_UPLOAD_CHANGE_REQUEST:
+    return state.set('is_changing_upload', true);
   case COMPOSE_SUBMIT_SUCCESS:
     return action.status && state.getIn(['advanced_options', 'threaded_mode']) ? continueThread(state, action.status) : clearAll(state);
   case COMPOSE_SUBMIT_FAIL:
-  case COMPOSE_UPLOAD_CHANGE_FAIL:
     return state.set('is_submitting', false);
+  case COMPOSE_UPLOAD_CHANGE_FAIL:
+    return state.set('is_changing_upload', false);
   case COMPOSE_UPLOAD_REQUEST:
     return state.set('is_uploading', true);
   case COMPOSE_UPLOAD_SUCCESS:
@@ -393,7 +397,7 @@ export default function compose(state = initialState, action) {
     return insertEmoji(state, action.position, action.emoji);
   case COMPOSE_UPLOAD_CHANGE_SUCCESS:
     return state
-      .set('is_submitting', false)
+      .set('is_changing_upload', false)
       .update('media_attachments', list => list.map(item => {
         if (item.get('id') === action.media.id) {
           return fromJS(action.media);
diff --git a/app/javascript/flavours/glitch/styles/components/index.scss b/app/javascript/flavours/glitch/styles/components/index.scss
index 873dfa98d..8e90aa545 100644
--- a/app/javascript/flavours/glitch/styles/components/index.scss
+++ b/app/javascript/flavours/glitch/styles/components/index.scss
@@ -606,6 +606,7 @@
   &__append {
     flex: 1 1 auto;
     position: relative;
+    min-height: 120px;
   }
 }
 
@@ -992,7 +993,6 @@
     transform: translateX(-50%);
     margin: 82px 0 0 50%;
     white-space: nowrap;
-    animation: loader-label 1.15s infinite cubic-bezier(0.215, 0.610, 0.355, 1.000);
   }
 }
 
@@ -1001,11 +1001,20 @@
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%);
-  width: 0;
-  height: 0;
+  width: 42px;
+  height: 42px;
   box-sizing: border-box;
+  background-color: transparent;
   border: 0 solid lighten($ui-base-color, 26%);
+  border-width: 6px;
   border-radius: 50%;
+}
+
+.no-reduce-motion .loading-indicator span {
+  animation: loader-label 1.15s infinite cubic-bezier(0.215, 0.610, 0.355, 1.000);
+}
+
+.no-reduce-motion .loading-indicator__figure {
   animation: loader-figure 1.15s infinite cubic-bezier(0.215, 0.610, 0.355, 1.000);
 }