Commit 77e52864 authored by Samuel Alphée Richard's avatar Samuel Alphée Richard
Browse files

Fixed JSON metadata in reply editor

parent 095d13f9
Pipeline #389519945 canceled with stages
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/anchor-is-valid */
/* eslint-disable jsx-a11y/tabindex-no-positive */
/* eslint-disable react/no-string-refs */
/* eslint-disable no-useless-escape */
/* eslint-disable no-underscore-dangle */
/* eslint-disable arrow-parens */
import React from 'react';
import PropTypes from 'prop-types';
import reactForm from 'app/utils/ReactForm';
......@@ -12,11 +19,14 @@ import Tooltip from 'app/components/elements/Tooltip';
import sanitizeConfig, { allowedTags } from 'app/utils/SanitizeConfig';
import sanitize from 'sanitize-html';
import HtmlReady from 'shared/HtmlReady';
import * as globalActions from 'app/redux/GlobalReducer';
import { connect } from 'react-redux';
// import { config } from '@blurtfoundation/blurtjs';
// import * as globalActions from 'app/redux/GlobalReducer';
import { fromJS, Set } from 'immutable';
import Remarkable from 'remarkable';
import Dropzone from 'react-dropzone';
import tt from 'counterpart';
const MAX_FILE_TO_UPLOAD = 10;
const imagesToUpload = [];
......@@ -832,8 +842,7 @@ function stateFromMarkdown(RichTextEditor, markdown) {
return stateFromHtml(RichTextEditor, html);
}
import { connect } from 'react-redux';
import { config } from '@blurtfoundation/blurtjs';
const richTextEditor = process.env.BROWSER
? require('react-rte-image').default
: null;
......@@ -853,7 +862,10 @@ export default (formId) =>
if (isStory) fields.push('category');
let { category, title, body } = ownProps;
if (/submit_/.test(type)) title = body = '';
if (/submit_/.test(type)) {
title = '';
body = '';
}
if (isStory && jsonMetadata && jsonMetadata.tags) {
category = Set([category, ...jsonMetadata.tags]).join(' ');
}
......@@ -1012,11 +1024,11 @@ export default (formId) =>
const meta = isEdit ? jsonMetadata : {};
if (allCategories.size) meta.tags = allCategories.toJS();
else delete meta.tags;
if (rtags.usertags.size) meta.users = rtags.usertags;
if (rtags.usertags.size) meta.users = Array.from(rtags.usertags);
else delete meta.users;
if (rtags.images.size) meta.image = rtags.images;
if (rtags.images.size) meta.image = Array.from(rtags.images);
else delete meta.image;
if (rtags.links.size) meta.links = rtags.links;
if (rtags.links.size) meta.links = Array.from(rtags.links);
else delete meta.links;
meta.app = 'blurt/0.1';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment