mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-12 19:06:13 +00:00
Fix create post for community not having community selected by default
This commit is contained in:
parent
bc658a80a4
commit
6c48cf1822
|
@ -1 +1 @@
|
|||
Subproject commit 7fc71d0860bbe5c6d620ec27112350ffe5b9229c
|
||||
Subproject commit a241fe1255a6363c7ae1ec5a09520c066745e6ce
|
|
@ -114,7 +114,7 @@ export class CreatePost extends Component<
|
|||
if (res.state === "success") {
|
||||
this.setState({
|
||||
selectedCommunityChoice: {
|
||||
label: res.data.community_view.community.name,
|
||||
label: res.data.community_view.community.title,
|
||||
value: res.data.community_view.community.id.toString(),
|
||||
},
|
||||
loading: false,
|
||||
|
|
|
@ -123,16 +123,16 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
|||
...this.state.form,
|
||||
community_id: getIdFromString(selectedCommunityChoice.value),
|
||||
},
|
||||
communitySearchOptions: [selectedCommunityChoice]
|
||||
.concat(
|
||||
communitySearchOptions: [selectedCommunityChoice].concat(
|
||||
(
|
||||
this.props.initialCommunities?.map(
|
||||
({ community: { id, title } }) => ({
|
||||
label: title,
|
||||
value: id.toString(),
|
||||
})
|
||||
) ?? []
|
||||
)
|
||||
.filter(option => option.value !== selectedCommunityChoice.value),
|
||||
).filter(option => option.value !== selectedCommunityChoice.value)
|
||||
),
|
||||
};
|
||||
} else {
|
||||
this.state = {
|
||||
|
|
Loading…
Reference in a new issue