about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/ui/util
diff options
context:
space:
mode:
authorNolan Lawson <nolan@nolanlawson.com>2017-10-27 08:04:44 -0700
committerunarist <m.unarist@gmail.com>2017-10-28 00:04:44 +0900
commit3de22a82bf1c3c0a3b593be4075cf42a3ec9291e (patch)
tree7b11776880a6122287b7fa0a84e0649bb346be86 /app/javascript/mastodon/features/ui/util
parente4080772b511e8dd436fddc79de10f44e4d83ff6 (diff)
Refactor initial state: reduce_motion and auto_play_gif (#5501)
Diffstat (limited to 'app/javascript/mastodon/features/ui/util')
-rw-r--r--app/javascript/mastodon/features/ui/util/optional_motion.js9
1 files changed, 1 insertions, 8 deletions
diff --git a/app/javascript/mastodon/features/ui/util/optional_motion.js b/app/javascript/mastodon/features/ui/util/optional_motion.js
index af6368738..82edbbe8f 100644
--- a/app/javascript/mastodon/features/ui/util/optional_motion.js
+++ b/app/javascript/mastodon/features/ui/util/optional_motion.js
@@ -4,11 +4,10 @@
 import React from 'react';
 import Motion from 'react-motion/lib/Motion';
 import PropTypes from 'prop-types';
+import { reduceMotion } from '../../../initial_state';
 
 const stylesToKeep = ['opacity', 'backgroundOpacity'];
 
-let reduceMotion;
-
 const extractValue = (value) => {
   // This is either an object with a "val" property or it's a number
   return (typeof value === 'object' && value && 'val' in value) ? value.val : value;
@@ -26,12 +25,6 @@ class OptionalMotion extends React.Component {
 
     const { style, defaultStyle, children } = this.props;
 
-    if (typeof reduceMotion !== 'boolean') {
-      // This never changes without a page reload, so we can just grab it
-      // once from the body classes as opposed to using Redux's connect(),
-      // which would unnecessarily update every state change
-      reduceMotion = document.body.classList.contains('reduce-motion');
-    }
     if (reduceMotion) {
       Object.keys(style).forEach(key => {
         if (stylesToKeep.includes(key)) {