get documentTitle(): string {
return this.state.communityRes.match({
some: res =>
- this.state.siteRes.site_view.match({
- some: siteView =>
- `${res.community_view.community.title} - ${siteView.site.name}`,
- none: "",
- }),
+ `${res.community_view.community.title} - ${this.state.siteRes.site_view.site.name}`,
none: "",
});
}
render() {
+ // For some reason, this returns an empty vec if it matches the site langs
+ let communityLangs = this.state.communityRes.map(r => {
+ let langs = r.discussion_languages;
+ if (langs.length == 0) {
+ return this.state.siteRes.all_languages.map(l => l.id);
+ } else {
+ return langs;
+ }
+ });
+
return (
<div className="container-lg">
{this.state.communityLoading ? (
admins={this.state.siteRes.admins}
online={res.online}
enableNsfw={enableNsfw(this.state.siteRes)}
+ editable
+ allLanguages={this.state.siteRes.all_languages}
+ siteLanguages={
+ this.state.siteRes.discussion_languages
+ }
+ communityLanguages={communityLangs}
/>
{!res.community_view.community.local &&
res.site.match({
admins={this.state.siteRes.admins}
online={res.online}
enableNsfw={enableNsfw(this.state.siteRes)}
+ editable
+ allLanguages={this.state.siteRes.all_languages}
+ siteLanguages={this.state.siteRes.discussion_languages}
+ communityLanguages={communityLangs}
/>
{!res.community_view.community.local &&
res.site.match({
enableDownvotes={enableDownvotes(this.state.siteRes)}
enableNsfw={enableNsfw(this.state.siteRes)}
allLanguages={this.state.siteRes.all_languages}
+ siteLanguages={this.state.siteRes.discussion_languages}
/>
)
) : this.state.commentsLoading ? (
admins={Some(this.state.siteRes.admins)}
maxCommentsShown={None}
allLanguages={this.state.siteRes.all_languages}
+ siteLanguages={this.state.siteRes.discussion_languages}
/>
);
}
) {
let data = wsJsonToRes<CommunityResponse>(msg, CommunityResponse);
this.state.communityRes.match({
- some: res => (res.community_view = data.community_view),
+ some: res => {
+ res.community_view = data.community_view;
+ res.discussion_languages = data.discussion_languages;
+ },
none: void 0,
});
this.setState(this.state);
op == UserOperation.DeletePost ||
op == UserOperation.RemovePost ||
op == UserOperation.LockPost ||
- op == UserOperation.StickyPost ||
+ op == UserOperation.FeaturePost ||
op == UserOperation.SavePost
) {
let data = wsJsonToRes<PostResponse>(msg, PostResponse);