Commit 8ba6770f authored by Maxime Chaillet's avatar Maxime Chaillet
Browse files

Stop sending username when creating or updating an event or uploading an...

Stop sending username when creating or updating an event or uploading an image. It fixes #269
parent b80ddb36
import { Editor } from '@tinymce/tinymce-react';
import axios from 'axios';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import tinymce from 'tinymce/tinymce';
import { getFileByEventId, uploadFile } from '../../../api/icat/icatPlus';
import UI from '../../../config/ui/config';
import { Editor } from '@tinymce/tinymce-react';
import axios from 'axios';
import { EditionModeConfig } from './tinymceConfig';
import { getContent } from '../../../helpers/eventHelpers';
import {
EDIT_EVENT_CONTEXT,
HTML_CONTENT_FORMAT,
LOCALSTORAGE_KEY_EDITED_EVENT_CONTENT_IN_HTML_FORMAT,
LOCALSTORAGE_KEY_EDITED_EVENT_CONTENT_IN_PLAINTEXT_FORMAT,
LOCALSTORAGE_KEY_NEW_EVENT_CONTENT_IN_HTML_FORMAT,
LOCALSTORAGE_KEY_NEW_EVENT_CONTENT_IN_PLAINTEXT_FORMAT,
EDIT_EVENT_CONTEXT,
NEW_EVENT_CONTEXT,
PLAINTEXT_CONTENT_FORMAT,
LOCALSTORAGE_KEY_NEW_EVENT_CONTENT_IN_PLAINTEXT_FORMAT,
LOCALSTORAGE_KEY_NEW_EVENT_CONTENT_IN_HTML_FORMAT,
LOCALSTORAGE_KEY_EDITED_EVENT_CONTENT_IN_PLAINTEXT_FORMAT,
LOCALSTORAGE_KEY_EDITED_EVENT_CONTENT_IN_HTML_FORMAT,
} from '../../../constants/eventTypes';
import { getContent } from '../../../helpers/eventHelpers';
import { EditionModeConfig } from './tinymceConfig';
import UI from '../../../config/ui/config';
import { getFileByEventId, uploadFile } from '../../../api/icat/icatPlus';
const EDITOR_ID_FOR_CREATION = 'myEditorForCreation';
const EDITOR_ID_FOR_EDITION = 'myEditorForEdition';
......@@ -193,7 +194,6 @@ export default class EditorWrapper extends Component {
data.append('creationDate', Date());
data.append('type', 'attachment');
data.append('category', 'file');
data.append('username', this.props.user.username);
axios({
method: 'post',
......
import { isEqual } from 'lodash-es';
import PropTypes from 'prop-types';
import React from 'react';
import PropTypes from 'prop-types';
import {
Button,
Glyphicon,
......@@ -18,6 +17,7 @@ import {
LOCALSTORAGE_KEY_NEW_EVENT_CONTENT_IN_HTML_FORMAT,
LOCALSTORAGE_KEY_NEW_EVENT_CONTENT_IN_PLAINTEXT_FORMAT,
} from '../../constants/eventTypes';
import { isEqual } from 'lodash-es';
import TagsSelectorContainer from '../../containers/Logbook/Tags/TagsSelectorContainer';
import { getContent } from '../../helpers/eventHelpers';
import EditorWrapper from './Editor/EditorWrapper';
......@@ -191,7 +191,7 @@ class NewOrEditEventPanel extends React.Component {
const currentTagIds = this.state.selectedTags.map((tag) => tag._id);
if (this.props.event) {
// edition of an event
const { event, user } = this.props;
const { event } = this.props;
this.props.onSaveButtonClicked({
_id: event._id,
......@@ -215,7 +215,6 @@ class NewOrEditEventPanel extends React.Component {
type: event.type,
tag: currentTagIds,
title: null,
username: user.username,
previousVersionEvent: event._id,
});
} else {
......@@ -241,7 +240,6 @@ class NewOrEditEventPanel extends React.Component {
title: null,
tag: currentTagIds,
type: ANNOTATION,
username: this.props.user.username,
});
}
}
......
import React from 'react';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import NewOrEditEventPanel from '../../components/Logbook/NewOrEditEventPanel';
const resources = require('./resources/NewOrEditEventPanel.resource.js');
......
......@@ -72,6 +72,6 @@ module.exports = {
testFunctionalProps: {
investigationId: '0',
event: createEventByAttributes({ username: 'testUsername' }),
user: { sessionId: 'sessionId', username: 'username' },
user: { sessionId: 'sessionId' },
},
};
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