summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post-form.tsx
diff options
context:
space:
mode:
authorFelix Ableitner <me@nutomic.com>2020-06-09 14:01:26 +0200
committerFelix Ableitner <me@nutomic.com>2020-06-09 14:01:26 +0200
commit0f1a8ec928a36d73490a41a778244578f39dd626 (patch)
treee55ec80acbb258197ce899cefe6e1b24e09ad2fb /ui/src/components/post-form.tsx
parent5c6601cb2a819d20b0f0d17f3575aff006a47fd2 (diff)
parenta13e9fe3959e07f901ba0647dfd7f749865a900d (diff)
Merge branch 'master' into federation
Diffstat (limited to 'ui/src/components/post-form.tsx')
-rw-r--r--ui/src/components/post-form.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx
index f04910be..22224c34 100644
--- a/ui/src/components/post-form.tsx
+++ b/ui/src/components/post-form.tsx
@@ -331,6 +331,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
value={this.state.postForm.community_id}
onInput={linkEvent(this, this.handlePostCommunityChange)}
>
+ <option>{i18n.t('select_a_community')}</option>
{this.state.communities.map(community => (
<option value={community.id}>
{community.local
@@ -362,7 +363,11 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
)}
<div class="form-group row">
<div class="col-sm-10">
- <button type="submit" class="btn btn-secondary mr-2">
+ <button
+ disabled={!this.state.postForm.community_id}
+ type="submit"
+ class="btn btn-secondary mr-2"
+ >
{this.state.loading ? (
<svg class="icon icon-spinner spin">
<use xlinkHref="#icon-spinner"></use>
@@ -568,7 +573,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
).id;
this.state.postForm.community_id = foundCommunityId;
} else {
- this.state.postForm.community_id = data.communities[0].id;
+ // By default, the null valued 'Select a Community'
}
this.setState(this.state);
@@ -578,6 +583,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
let selector = new Selectr(selectId, { nativeDropdown: false });
selector.on('selectr.select', option => {
this.state.postForm.community_id = Number(option.value);
+ this.setState(this.state);
});
}
} else if (res.op == UserOperation.CreatePost) {