mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-29 07:41:13 +00:00
Make more post params cross-postable (#2621)
This commit is contained in:
parent
cd15d3c132
commit
5d124a3e14
3 changed files with 24 additions and 1 deletions
|
@ -203,6 +203,9 @@ export class CreatePost extends Component<
|
||||||
title: locationState.name,
|
title: locationState.name,
|
||||||
url: locationState.url,
|
url: locationState.url,
|
||||||
body: locationState.body,
|
body: locationState.body,
|
||||||
|
altText: locationState.altText,
|
||||||
|
nsfw: locationState.nsfw,
|
||||||
|
languageId: locationState.languageId,
|
||||||
});
|
});
|
||||||
this.setState(s => ({ resetCounter: s.resetCounter + 1 }));
|
this.setState(s => ({ resetCounter: s.resetCounter + 1 }));
|
||||||
}
|
}
|
||||||
|
@ -234,6 +237,7 @@ export class CreatePost extends Component<
|
||||||
title,
|
title,
|
||||||
nsfw,
|
nsfw,
|
||||||
url,
|
url,
|
||||||
|
altText,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const params: PostFormParams = {
|
const params: PostFormParams = {
|
||||||
|
@ -244,6 +248,7 @@ export class CreatePost extends Component<
|
||||||
custom_thumbnail: customThumbnailUrl,
|
custom_thumbnail: customThumbnailUrl,
|
||||||
language_id: languageId,
|
language_id: languageId,
|
||||||
nsfw: nsfw === "true",
|
nsfw: nsfw === "true",
|
||||||
|
alt_text: altText,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -278,6 +283,7 @@ export class CreatePost extends Component<
|
||||||
onUrlBlur={this.handleUrlBlur}
|
onUrlBlur={this.handleUrlBlur}
|
||||||
onThumbnailUrlBlur={this.handleThumbnailUrlBlur}
|
onThumbnailUrlBlur={this.handleThumbnailUrlBlur}
|
||||||
onNsfwChange={this.handleNsfwChange}
|
onNsfwChange={this.handleNsfwChange}
|
||||||
|
onAltTextBlur={this.handleAltTextBlur}
|
||||||
onCopySuggestedTitle={this.handleCopySuggestedTitle}
|
onCopySuggestedTitle={this.handleCopySuggestedTitle}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -878,7 +878,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
get crossPostParams(): CrossPostParams {
|
get crossPostParams(): CrossPostParams {
|
||||||
const { name, url } = this.postView.post;
|
const { name, url, alt_text, nsfw, language_id } = this.postView.post;
|
||||||
const crossPostParams: CrossPostParams = { name };
|
const crossPostParams: CrossPostParams = { name };
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
|
@ -890,6 +890,18 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
crossPostParams.body = crossPostBody;
|
crossPostParams.body = crossPostBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (alt_text) {
|
||||||
|
crossPostParams.altText = alt_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nsfw) {
|
||||||
|
crossPostParams.nsfw = nsfw ? "true" : "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (language_id !== undefined) {
|
||||||
|
crossPostParams.languageId = language_id;
|
||||||
|
}
|
||||||
|
|
||||||
return crossPostParams;
|
return crossPostParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
|
import StringBoolean from "./string-boolean";
|
||||||
|
|
||||||
export default interface CrossPostParams {
|
export default interface CrossPostParams {
|
||||||
name: string;
|
name: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
body?: string;
|
body?: string;
|
||||||
|
altText?: string;
|
||||||
|
nsfw?: StringBoolean;
|
||||||
|
languageId?: number;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue