Merge master into federation #48

Manually merged
nutomic merged 120 commits from merge-master into federation 2020-06-09 18:07:02 +00:00
2 changed files with 15 additions and 6 deletions
Showing only changes of commit d9ec95ab5b - Show all commits

View File

@ -194,8 +194,9 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
<form> <form>
<label <label
htmlFor="file-upload" htmlFor="file-upload"
className={`${UserService.Instance.user && className={`${
'pointer'} d-inline-block float-right text-muted font-weight-bold`} UserService.Instance.user && 'pointer'
} d-inline-block float-right text-muted font-weight-bold`}
data-tippy-content={i18n.t('upload_image')} data-tippy-content={i18n.t('upload_image')}
> >
<svg class="icon icon-inline"> <svg class="icon icon-inline">
@ -288,8 +289,9 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
)} )}
{this.state.postForm.body && ( {this.state.postForm.body && (
<button <button
className={`mt-1 mr-2 btn btn-sm btn-secondary ${this.state className={`mt-1 mr-2 btn btn-sm btn-secondary ${
.previewMode && 'active'}`} this.state.previewMode && 'active'
}`}
onClick={linkEvent(this, this.handlePreviewToggle)} onClick={linkEvent(this, this.handlePreviewToggle)}
> >
{i18n.t('preview')} {i18n.t('preview')}
@ -328,6 +330,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
value={this.state.postForm.community_id} value={this.state.postForm.community_id}
onInput={linkEvent(this, this.handlePostCommunityChange)} onInput={linkEvent(this, this.handlePostCommunityChange)}
> >
<option>{i18n.t('select_a_community')}</option>
{this.state.communities.map(community => ( {this.state.communities.map(community => (
<option value={community.id}>{community.name}</option> <option value={community.id}>{community.name}</option>
))} ))}
@ -355,7 +358,11 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
)} )}
<div class="form-group row"> <div class="form-group row">
<div class="col-sm-10"> <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 ? ( {this.state.loading ? (
<svg class="icon icon-spinner spin"> <svg class="icon icon-spinner spin">
<use xlinkHref="#icon-spinner"></use> <use xlinkHref="#icon-spinner"></use>
@ -561,7 +568,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
).id; ).id;
this.state.postForm.community_id = foundCommunityId; this.state.postForm.community_id = foundCommunityId;
} else { } else {
this.state.postForm.community_id = data.communities[0].id; // By default, the null valued 'Select a Community'
} }
this.setState(this.state); this.setState(this.state);
@ -571,6 +578,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
let selector = new Selectr(selectId, { nativeDropdown: false }); let selector = new Selectr(selectId, { nativeDropdown: false });
selector.on('selectr.select', option => { selector.on('selectr.select', option => {
this.state.postForm.community_id = Number(option.value); this.state.postForm.community_id = Number(option.value);
this.setState(this.state);
}); });
} }
} else if (res.op == UserOperation.CreatePost) { } else if (res.op == UserOperation.CreatePost) {

View File

@ -18,6 +18,7 @@
"communities": "Communities", "communities": "Communities",
"users": "Users", "users": "Users",
"create_a_community": "Create a community", "create_a_community": "Create a community",
"select_a_community": "Select a community",
"create_community": "Create Community", "create_community": "Create Community",
"remove_community": "Remove Community", "remove_community": "Remove Community",
"subscribed_to_communities": "Subscribed to <1>communities</1>", "subscribed_to_communities": "Subscribed to <1>communities</1>",