about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/flavours/glitch/features')
-rw-r--r--app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js4
-rw-r--r--app/javascript/flavours/glitch/features/composer/index.js8
-rw-r--r--app/javascript/flavours/glitch/features/composer/options/dropdown/content/index.js6
-rw-r--r--app/javascript/flavours/glitch/features/composer/options/dropdown/content/item/index.js5
-rw-r--r--app/javascript/flavours/glitch/features/composer/options/index.js48
-rw-r--r--app/javascript/flavours/glitch/features/direct_timeline/containers/column_settings_container.js4
-rw-r--r--app/javascript/flavours/glitch/features/favourited_statuses/index.js10
-rw-r--r--app/javascript/flavours/glitch/features/getting_started/index.js2
-rw-r--r--app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js4
-rw-r--r--app/javascript/flavours/glitch/features/notifications/components/column_settings.js4
-rw-r--r--app/javascript/flavours/glitch/features/notifications/containers/column_settings_container.js8
-rw-r--r--app/javascript/flavours/glitch/features/public_timeline/containers/column_settings_container.js4
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/embed_modal.js4
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js8
14 files changed, 60 insertions, 59 deletions
diff --git a/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js
index 84234a836..39387abb9 100644
--- a/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js
+++ b/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js
@@ -8,8 +8,8 @@ const mapStateToProps = state => ({
 
 const mapDispatchToProps = dispatch => ({
 
-  onChange (key, checked) {
-    dispatch(changeSetting(['community', ...key], checked));
+  onChange (path, checked) {
+    dispatch(changeSetting(['community', ...path], checked));
   },
 
 });
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js
index cae9bf9f2..29a2f4775 100644
--- a/app/javascript/flavours/glitch/features/composer/index.js
+++ b/app/javascript/flavours/glitch/features/composer/index.js
@@ -350,10 +350,10 @@ class Composer extends React.Component {
           acceptContentTypes={acceptContentTypes}
           advancedOptions={advancedOptions}
           disabled={isSubmitting}
-          full={media.size >= 4 || media.some(
+          full={media ? media.size >= 4 || media.some(
             item => item.get('type') === 'video'
-          )}
-          hasMedia={!!media.size}
+          ) : false}
+          hasMedia={media && !!media.size}
           intl={intl}
           onChangeAdvancedOption={onChangeAdvancedOption}
           onChangeSensitivity={onChangeSensitivity}
@@ -369,7 +369,7 @@ class Composer extends React.Component {
           spoiler={spoiler}
         />
         <ComposerPublisher
-          countText={`${spoilerText}${countableText(text)}${advancedOptions.get('do_not_federate') ? ' 👁️' : ''}`}
+          countText={`${spoilerText}${countableText(text)}${advancedOptions && advancedOptions.get('do_not_federate') ? ' 👁️' : ''}`}
           disabled={isSubmitting || isUploading || !!text.length && !text.trim().length}
           intl={intl}
           onSecondarySubmit={handleSecondarySubmit}
diff --git a/app/javascript/flavours/glitch/features/composer/options/dropdown/content/index.js b/app/javascript/flavours/glitch/features/composer/options/dropdown/content/index.js
index 28bdfc0db..b3a472999 100644
--- a/app/javascript/flavours/glitch/features/composer/options/dropdown/content/index.js
+++ b/app/javascript/flavours/glitch/features/composer/options/dropdown/content/index.js
@@ -96,7 +96,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
               transform: `scale(${scaleX}, ${scaleY})`,
             }}
           >
-            {items.map(
+            {items ? items.map(
               ({
                 name,
                 ...rest
@@ -110,7 +110,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
                   options={rest}
                 />
               )
-            )}
+            ) : null}
           </div>
         )}
       </Motion>
@@ -127,7 +127,7 @@ ComposerOptionsDropdownContent.propTypes = {
     name: PropTypes.string.isRequired,
     on: PropTypes.bool,
     text: PropTypes.node,
-  })).isRequired,
+  })),
   onChange: PropTypes.func,
   onClose: PropTypes.func,
   style: PropTypes.object,
diff --git a/app/javascript/flavours/glitch/features/composer/options/dropdown/content/item/index.js b/app/javascript/flavours/glitch/features/composer/options/dropdown/content/item/index.js
index 605c945bd..68a52083f 100644
--- a/app/javascript/flavours/glitch/features/composer/options/dropdown/content/item/index.js
+++ b/app/javascript/flavours/glitch/features/composer/options/dropdown/content/item/index.js
@@ -104,7 +104,10 @@ export default class ComposerOptionsDropdownContentItem extends React.PureCompon
             <strong>{text}</strong>
             {meta}
           </div>
-        ) : <div className='content'>{text}</div>}
+        ) :
+          <div className='content'>
+            <strong>{text}</strong>
+          </div>}
       </div>
     );
   }
diff --git a/app/javascript/flavours/glitch/features/composer/options/index.js b/app/javascript/flavours/glitch/features/composer/options/index.js
index 954508c11..c129622bc 100644
--- a/app/javascript/flavours/glitch/features/composer/options/index.js
+++ b/app/javascript/flavours/glitch/features/composer/options/index.js
@@ -292,31 +292,29 @@ export default class ComposerOptions extends React.PureComponent {
           onClick={onToggleSpoiler}
           title={intl.formatMessage(messages.spoiler)}
         />
-        {advancedOptions ? (
-          <Dropdown
-            active={advancedOptions.some(value => !!value)}
-            disabled={disabled}
-            icon='ellipsis-h'
-            items={[
-              {
-                meta: <FormattedMessage {...messages.local_only_long} />,
-                name: 'do_not_federate',
-                on: advancedOptions.get('do_not_federate'),
-                text: <FormattedMessage {...messages.local_only_short} />,
-              },
-              {
-                meta: <FormattedMessage {...messages.threaded_mode_long} />,
-                name: 'threaded_mode',
-                on: advancedOptions.get('threaded_mode'),
-                text: <FormattedMessage {...messages.threaded_mode_short} />,
-              },
-            ]}
-            onChange={onChangeAdvancedOption}
-            onModalClose={onModalClose}
-            onModalOpen={onModalOpen}
-            title={intl.formatMessage(messages.advanced_options_icon_title)}
-          />
-        ) : null}
+        <Dropdown
+          active={advancedOptions && advancedOptions.some(value => !!value)}
+          disabled={disabled}
+          icon='ellipsis-h'
+          items={advancedOptions ? [
+            {
+              meta: <FormattedMessage {...messages.local_only_long} />,
+              name: 'do_not_federate',
+              on: advancedOptions.get('do_not_federate'),
+              text: <FormattedMessage {...messages.local_only_short} />,
+            },
+            {
+              meta: <FormattedMessage {...messages.threaded_mode_long} />,
+              name: 'threaded_mode',
+              on: advancedOptions.get('threaded_mode'),
+              text: <FormattedMessage {...messages.threaded_mode_short} />,
+            },
+          ] : null}
+          onChange={onChangeAdvancedOption}
+          onModalClose={onModalClose}
+          onModalOpen={onModalOpen}
+          title={intl.formatMessage(messages.advanced_options_icon_title)}
+        />
       </div>
     );
   }
diff --git a/app/javascript/flavours/glitch/features/direct_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/direct_timeline/containers/column_settings_container.js
index d3e4b4216..7292af264 100644
--- a/app/javascript/flavours/glitch/features/direct_timeline/containers/column_settings_container.js
+++ b/app/javascript/flavours/glitch/features/direct_timeline/containers/column_settings_container.js
@@ -8,8 +8,8 @@ const mapStateToProps = state => ({
 
 const mapDispatchToProps = dispatch => ({
 
-  onChange (key, checked) {
-    dispatch(changeSetting(['direct', ...key], checked));
+  onChange (path, checked) {
+    dispatch(changeSetting(['direct', ...path], checked));
   },
 
 });
diff --git a/app/javascript/flavours/glitch/features/favourited_statuses/index.js b/app/javascript/flavours/glitch/features/favourited_statuses/index.js
index e20dda718..301a5ae4f 100644
--- a/app/javascript/flavours/glitch/features/favourited_statuses/index.js
+++ b/app/javascript/flavours/glitch/features/favourited_statuses/index.js
@@ -9,6 +9,7 @@ import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/col
 import StatusList from 'flavours/glitch/components/status_list';
 import { defineMessages, injectIntl } from 'react-intl';
 import ImmutablePureComponent from 'react-immutable-pure-component';
+import { debounce } from 'lodash';
 
 const messages = defineMessages({
   heading: { id: 'column.favourites', defaultMessage: 'Favourites' },
@@ -16,6 +17,7 @@ const messages = defineMessages({
 
 const mapStateToProps = state => ({
   statusIds: state.getIn(['status_lists', 'favourites', 'items']),
+  isLoading: state.getIn(['status_lists', 'favourites', 'isLoading'], true),
   hasMore: !!state.getIn(['status_lists', 'favourites', 'next']),
 });
 
@@ -30,6 +32,7 @@ export default class Favourites extends ImmutablePureComponent {
     columnId: PropTypes.string,
     multiColumn: PropTypes.bool,
     hasMore: PropTypes.bool,
+    isLoading: PropTypes.bool,
   };
 
   componentWillMount () {
@@ -59,12 +62,12 @@ export default class Favourites extends ImmutablePureComponent {
     this.column = c;
   }
 
-  handleScrollToBottom = () => {
+  handleScrollToBottom = debounce(() => {
     this.props.dispatch(expandFavouritedStatuses());
-  }
+  }, 300, { leading: true })
 
   render () {
-    const { intl, statusIds, columnId, multiColumn, hasMore } = this.props;
+    const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props;
     const pinned = !!columnId;
 
     return (
@@ -85,6 +88,7 @@ export default class Favourites extends ImmutablePureComponent {
           statusIds={statusIds}
           scrollKey={`favourited_statuses-${columnId}`}
           hasMore={hasMore}
+          isLoading={isLoading}
           onScrollToBottom={this.handleScrollToBottom}
         />
       </Column>
diff --git a/app/javascript/flavours/glitch/features/getting_started/index.js b/app/javascript/flavours/glitch/features/getting_started/index.js
index 1b05c4da1..0077f193b 100644
--- a/app/javascript/flavours/glitch/features/getting_started/index.js
+++ b/app/javascript/flavours/glitch/features/getting_started/index.js
@@ -79,7 +79,7 @@ export default class GettingStarted extends ImmutablePureComponent {
   render () {
     const { intl, myAccount, columns, multiColumn, lists } = this.props;
 
-    let navItems = [];
+    const navItems = [];
     let listItems = [];
 
     if (multiColumn) {
diff --git a/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js
index 19a8e792f..16747151b 100644
--- a/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js
+++ b/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js
@@ -8,8 +8,8 @@ const mapStateToProps = state => ({
 
 const mapDispatchToProps = dispatch => ({
 
-  onChange (key, checked) {
-    dispatch(changeSetting(['home', ...key], checked));
+  onChange (path, checked) {
+    dispatch(changeSetting(['home', ...path], checked));
   },
 
   onSave () {
diff --git a/app/javascript/flavours/glitch/features/notifications/components/column_settings.js b/app/javascript/flavours/glitch/features/notifications/components/column_settings.js
index 23545185c..d9638aaf3 100644
--- a/app/javascript/flavours/glitch/features/notifications/components/column_settings.js
+++ b/app/javascript/flavours/glitch/features/notifications/components/column_settings.js
@@ -14,8 +14,8 @@ export default class ColumnSettings extends React.PureComponent {
     onClear: PropTypes.func.isRequired,
   };
 
-  onPushChange = (key, checked) => {
-    this.props.onChange(['push', ...key], checked);
+  onPushChange = (path, checked) => {
+    this.props.onChange(['push', ...path], checked);
   }
 
   render () {
diff --git a/app/javascript/flavours/glitch/features/notifications/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/notifications/containers/column_settings_container.js
index 95109fe4d..9585ea556 100644
--- a/app/javascript/flavours/glitch/features/notifications/containers/column_settings_container.js
+++ b/app/javascript/flavours/glitch/features/notifications/containers/column_settings_container.js
@@ -18,11 +18,11 @@ const mapStateToProps = state => ({
 
 const mapDispatchToProps = (dispatch, { intl }) => ({
 
-  onChange (key, checked) {
-    if (key[0] === 'push') {
-      dispatch(changePushNotifications(key.slice(1), checked));
+  onChange (path, checked) {
+    if (path[0] === 'push') {
+      dispatch(changePushNotifications(path.slice(1), checked));
     } else {
-      dispatch(changeSetting(['notifications', ...key], checked));
+      dispatch(changeSetting(['notifications', ...path], checked));
     }
   },
 
diff --git a/app/javascript/flavours/glitch/features/public_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/public_timeline/containers/column_settings_container.js
index b13e20645..f042adbe6 100644
--- a/app/javascript/flavours/glitch/features/public_timeline/containers/column_settings_container.js
+++ b/app/javascript/flavours/glitch/features/public_timeline/containers/column_settings_container.js
@@ -8,8 +8,8 @@ const mapStateToProps = state => ({
 
 const mapDispatchToProps = dispatch => ({
 
-  onChange (key, checked) {
-    dispatch(changeSetting(['public', ...key], checked));
+  onChange (path, checked) {
+    dispatch(changeSetting(['public', ...path], checked));
   },
 
 });
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 1afffb51b..f3553f4a9 100644
--- a/app/javascript/flavours/glitch/features/ui/components/embed_modal.js
+++ b/app/javascript/flavours/glitch/features/ui/components/embed_modal.js
@@ -2,7 +2,7 @@ import React from 'react';
 import PropTypes from 'prop-types';
 import ImmutablePureComponent from 'react-immutable-pure-component';
 import { FormattedMessage, injectIntl } from 'react-intl';
-import axios from 'axios';
+import api from 'flavours/glitch/util/api';
 
 @injectIntl
 export default class EmbedModal extends ImmutablePureComponent {
@@ -23,7 +23,7 @@ export default class EmbedModal extends ImmutablePureComponent {
 
     this.setState({ loading: true });
 
-    axios.post('/api/web/embed', { url }).then(res => {
+    api().post('/api/web/embed', { url }).then(res => {
       this.setState({ loading: false, oembed: res.data });
 
       const iframeDocument = this.iframe.contentWindow.document;
diff --git a/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js b/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js
index 91a83f330..4c910daec 100644
--- a/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js
+++ b/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js
@@ -38,11 +38,6 @@ PageOne.propTypes = {
   domain: PropTypes.string.isRequired,
 };
 
-const composerState = {
-  showSearch: true,
-  text: 'Awoo! #introductions',
-};
-
 const PageTwo = ({ intl, myAccount }) => (
   <div className='onboarding-modal__page onboarding-modal__page-two'>
     <div className='figure non-interactive'>
@@ -50,7 +45,8 @@ const PageTwo = ({ intl, myAccount }) => (
         <DrawerAccount account={myAccount} />
         <RawComposer
           intl={intl}
-          state={composerState}
+          privacy='public'
+          text='Awoo! #introductions'
         />
       </div>
     </div>