about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/ui/components/video_modal.jsx
diff options
context:
space:
mode:
authorChristian Schmidt <github@chsc.dk>2023-02-26 20:13:27 +0100
committerClaire <claire.github-309c@sitedethib.com>2023-03-05 17:52:53 +0100
commit0e476f3c4fbbcab9b4895b8abff93075dfd2bf0c (patch)
treeae50a1c4344476421eb36fc254ec9bbcfcfc6f8a /app/javascript/flavours/glitch/features/ui/components/video_modal.jsx
parent276c1d32d6fc857a768244c3f5d835c9c5da1747 (diff)
[Glitch] Add `lang` attribute to media and poll options
Port d3eefead3014175b264cb56f6f4cb552cbaaeac6 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui/components/video_modal.jsx')
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/video_modal.jsx12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/video_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/video_modal.jsx
index 90be11e4b..c1f837717 100644
--- a/app/javascript/flavours/glitch/features/ui/components/video_modal.jsx
+++ b/app/javascript/flavours/glitch/features/ui/components/video_modal.jsx
@@ -2,11 +2,17 @@ import React from 'react';
 import ImmutablePropTypes from 'react-immutable-proptypes';
 import PropTypes from 'prop-types';
 import Video from 'flavours/glitch/features/video';
+import { connect } from 'react-redux';
 import ImmutablePureComponent from 'react-immutable-pure-component';
 import Footer from 'flavours/glitch/features/picture_in_picture/components/footer';
 import { getAverageFromBlurhash } from 'flavours/glitch/blurhash';
 
-export default class VideoModal extends ImmutablePureComponent {
+const mapStateToProps = (state, { statusId }) => ({
+  language: state.getIn(['statuses', statusId, 'language']),
+});
+
+export default @connect(mapStateToProps, null, null, { forwardRef: true })
+class VideoModal extends ImmutablePureComponent {
 
   static contextTypes = {
     router: PropTypes.object,
@@ -15,6 +21,7 @@ export default class VideoModal extends ImmutablePureComponent {
   static propTypes = {
     media: ImmutablePropTypes.map.isRequired,
     statusId: PropTypes.string,
+    language: PropTypes.string,
     options: PropTypes.shape({
       startTime: PropTypes.number,
       autoPlay: PropTypes.bool,
@@ -35,7 +42,7 @@ export default class VideoModal extends ImmutablePureComponent {
   }
 
   render () {
-    const { media, statusId, onClose } = this.props;
+    const { media, statusId, language, onClose } = this.props;
     const options = this.props.options || {};
 
     return (
@@ -53,6 +60,7 @@ export default class VideoModal extends ImmutablePureComponent {
             autoFocus
             detailed
             alt={media.get('description')}
+            lang={language}
           />
         </div>