Fixed group editing
• Fixed: - group editing dialog • Updated: - FileInput to take in file from props to state - GroupCreateModal, GroupCreate to take in groupId
This commit is contained in:
parent
10686f32ef
commit
e09265279d
@ -20,7 +20,7 @@ export default class FileInput extends PureComponent {
|
||||
}
|
||||
|
||||
state = {
|
||||
file: null,
|
||||
file: this.props.file,
|
||||
}
|
||||
|
||||
handleOnChange = (e) => {
|
||||
|
@ -1,31 +1,34 @@
|
||||
import { defineMessages, injectIntl } from 'react-intl'
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
||||
import ModalLayout from './modal_layout'
|
||||
import GroupCreate from '../../features/group_create'
|
||||
|
||||
const messages = defineMessages({
|
||||
title: { id: 'create_group', defaultMessage: 'Create group' },
|
||||
update: { id: 'groups.form.update', defaultMessage: 'Update group' },
|
||||
})
|
||||
|
||||
export default
|
||||
@injectIntl
|
||||
class GroupCreateModal extends ImmutablePureComponent {
|
||||
class GroupCreateModal extends PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
intl: PropTypes.object.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
groupId: PropTypes.string,
|
||||
}
|
||||
|
||||
render() {
|
||||
const { intl, onClose } = this.props
|
||||
const { intl, onClose, groupId } = this.props
|
||||
|
||||
const title = intl.formatMessage(groupId ? messages.update : messages.title)
|
||||
|
||||
return (
|
||||
<ModalLayout
|
||||
title={intl.formatMessage(messages.title)}
|
||||
title={title}
|
||||
width={440}
|
||||
onClose={onClose}
|
||||
>
|
||||
<GroupCreate onCloseModal={onClose} />
|
||||
<GroupCreate onCloseModal={onClose} params={{ id: groupId }} />
|
||||
</ModalLayout>
|
||||
)
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ const messages = defineMessages({
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
|
||||
onOpenEditGroup(group) {
|
||||
onOpenEditGroup(groupId) {
|
||||
dispatch(closePopover())
|
||||
dispatch(openModal(MODAL_GROUP_CREATE, { group }))
|
||||
dispatch(openModal(MODAL_GROUP_CREATE, { groupId }))
|
||||
},
|
||||
|
||||
onOpenRemovedMembers(groupId) {
|
||||
@ -54,7 +54,7 @@ class GroupOptionsPopover extends ImmutablePureComponent {
|
||||
updateOnProps = ['group']
|
||||
|
||||
handleEditGroup = () => {
|
||||
this.props.onOpenEditGroup(this.props.group)
|
||||
this.props.onOpenEditGroup(this.props.group.get('id'))
|
||||
}
|
||||
|
||||
handleOnOpenRemovedMembers = () => {
|
||||
|
@ -167,6 +167,7 @@ class GroupCreate extends ImmutablePureComponent {
|
||||
disabled={isSubmitting}
|
||||
title={intl.formatMessage(coverImage === null ? messages.coverImage : messages.coverImageChange)}
|
||||
onChange={this.handleCoverImageChange}
|
||||
file={group ? group.get('cover_image_url') : undefined}
|
||||
width='340px'
|
||||
height='145px'
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user