mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-26 18:54:12 +00:00
Merge branch 'main' into release/v0.17
This commit is contained in:
commit
4eb902306d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -71,29 +71,18 @@ server.get("/css/themes/:name", async (req, res) => {
|
||||||
res.sendFile(customTheme);
|
res.sendFile(customTheme);
|
||||||
} else {
|
} else {
|
||||||
const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`);
|
const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`);
|
||||||
res.sendFile(internalTheme);
|
|
||||||
|
// If the theme doesn't exist, just send litely
|
||||||
|
if (fs.existsSync(internalTheme)) {
|
||||||
|
res.sendFile(internalTheme);
|
||||||
|
} else {
|
||||||
|
res.sendFile(path.resolve("./dist/assets/css/themes/litely.css"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function buildThemeList(): string[] {
|
function buildThemeList(): string[] {
|
||||||
let themes = [
|
let themes = ["darkly", "darkly-red", "litely", "litely-red"];
|
||||||
"litera",
|
|
||||||
"materia",
|
|
||||||
"minty",
|
|
||||||
"solar",
|
|
||||||
"united",
|
|
||||||
"cyborg",
|
|
||||||
"darkly",
|
|
||||||
"darkly-red",
|
|
||||||
"journal",
|
|
||||||
"sketchy",
|
|
||||||
"vaporwave",
|
|
||||||
"vaporwave-dark",
|
|
||||||
"i386",
|
|
||||||
"litely",
|
|
||||||
"litely-red",
|
|
||||||
"nord",
|
|
||||||
];
|
|
||||||
if (fs.existsSync(extraThemesFolder)) {
|
if (fs.existsSync(extraThemesFolder)) {
|
||||||
let dirThemes = fs.readdirSync(extraThemesFolder);
|
let dirThemes = fs.readdirSync(extraThemesFolder);
|
||||||
let cssThemes = dirThemes
|
let cssThemes = dirThemes
|
||||||
|
|
|
@ -184,7 +184,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
|
||||||
let data = wsJsonToRes<CommentResponse>(msg);
|
let data = wsJsonToRes<CommentResponse>(msg);
|
||||||
|
|
||||||
// This only finishes this form, if the randomly generated form_id matches the one received
|
// This only finishes this form, if the randomly generated form_id matches the one received
|
||||||
if (this.state.formId == data.form_id) {
|
if (this.state.formId && this.state.formId == data.form_id) {
|
||||||
this.setState({ finished: true });
|
this.setState({ finished: true });
|
||||||
|
|
||||||
// Necessary because it broke tribute for some reason
|
// Necessary because it broke tribute for some reason
|
||||||
|
|
|
@ -161,7 +161,6 @@ export class Post extends Component<any, PostState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchPost() {
|
fetchPost() {
|
||||||
this.setState({ commentsRes: undefined, postRes: undefined });
|
|
||||||
let auth = myAuth(false);
|
let auth = myAuth(false);
|
||||||
let postForm: GetPost = {
|
let postForm: GetPost = {
|
||||||
id: this.state.postId,
|
id: this.state.postId,
|
||||||
|
@ -498,6 +497,8 @@ export class Post extends Component<any, PostState> {
|
||||||
i.setState({
|
i.setState({
|
||||||
commentSort: CommentSortType[event.target.value],
|
commentSort: CommentSortType[event.target.value],
|
||||||
commentViewType: CommentViewType.Tree,
|
commentViewType: CommentViewType.Tree,
|
||||||
|
commentsRes: undefined,
|
||||||
|
postRes: undefined,
|
||||||
});
|
});
|
||||||
i.fetchPost();
|
i.fetchPost();
|
||||||
}
|
}
|
||||||
|
@ -694,9 +695,9 @@ export class Post extends Component<any, PostState> {
|
||||||
op == UserOperation.SavePost
|
op == UserOperation.SavePost
|
||||||
) {
|
) {
|
||||||
let data = wsJsonToRes<PostResponse>(msg);
|
let data = wsJsonToRes<PostResponse>(msg);
|
||||||
let pv = this.state.postRes?.post_view;
|
let res = this.state.postRes;
|
||||||
if (pv) {
|
if (res) {
|
||||||
pv = data.post_view;
|
res.post_view = data.post_view;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
setupTippy();
|
setupTippy();
|
||||||
}
|
}
|
||||||
|
@ -716,10 +717,10 @@ export class Post extends Component<any, PostState> {
|
||||||
} else if (op == UserOperation.BanFromCommunity) {
|
} else if (op == UserOperation.BanFromCommunity) {
|
||||||
let data = wsJsonToRes<BanFromCommunityResponse>(msg);
|
let data = wsJsonToRes<BanFromCommunityResponse>(msg);
|
||||||
|
|
||||||
let postRes = this.state.postRes;
|
let res = this.state.postRes;
|
||||||
if (postRes) {
|
if (res) {
|
||||||
if (postRes.post_view.creator.id == data.person_view.person.id) {
|
if (res.post_view.creator.id == data.person_view.person.id) {
|
||||||
postRes.post_view.creator_banned_from_community = data.banned;
|
res.post_view.creator_banned_from_community = data.banned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,9 +730,9 @@ export class Post extends Component<any, PostState> {
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
} else if (op == UserOperation.AddModToCommunity) {
|
} else if (op == UserOperation.AddModToCommunity) {
|
||||||
let data = wsJsonToRes<AddModToCommunityResponse>(msg);
|
let data = wsJsonToRes<AddModToCommunityResponse>(msg);
|
||||||
let postRes = this.state.postRes;
|
let res = this.state.postRes;
|
||||||
if (postRes) {
|
if (res) {
|
||||||
postRes.moderators = data.moderators;
|
res.moderators = data.moderators;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
}
|
}
|
||||||
} else if (op == UserOperation.BanPerson) {
|
} else if (op == UserOperation.BanPerson) {
|
||||||
|
@ -740,10 +741,10 @@ export class Post extends Component<any, PostState> {
|
||||||
.filter(c => c.creator.id == data.person_view.person.id)
|
.filter(c => c.creator.id == data.person_view.person.id)
|
||||||
.forEach(c => (c.creator.banned = data.banned));
|
.forEach(c => (c.creator.banned = data.banned));
|
||||||
|
|
||||||
let postRes = this.state.postRes;
|
let res = this.state.postRes;
|
||||||
if (postRes) {
|
if (res) {
|
||||||
if (postRes.post_view.creator.id == data.person_view.person.id) {
|
if (res.post_view.creator.id == data.person_view.person.id) {
|
||||||
postRes.post_view.creator.banned = data.banned;
|
res.post_view.creator.banned = data.banned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
|
@ -753,7 +754,7 @@ export class Post extends Component<any, PostState> {
|
||||||
} else if (op == UserOperation.Search) {
|
} else if (op == UserOperation.Search) {
|
||||||
let data = wsJsonToRes<SearchResponse>(msg);
|
let data = wsJsonToRes<SearchResponse>(msg);
|
||||||
let xPosts = data.posts.filter(
|
let xPosts = data.posts.filter(
|
||||||
p => p.post.id != Number(this.props.match.params.id)
|
p => p.post.ap_id != this.state.postRes?.post_view.post.ap_id
|
||||||
);
|
);
|
||||||
this.setState({ crossPosts: xPosts.length > 0 ? xPosts : undefined });
|
this.setState({ crossPosts: xPosts.length > 0 ? xPosts : undefined });
|
||||||
} else if (op == UserOperation.LeaveAdmin) {
|
} else if (op == UserOperation.LeaveAdmin) {
|
||||||
|
@ -761,11 +762,11 @@ export class Post extends Component<any, PostState> {
|
||||||
this.setState({ siteRes: data });
|
this.setState({ siteRes: data });
|
||||||
} else if (op == UserOperation.TransferCommunity) {
|
} else if (op == UserOperation.TransferCommunity) {
|
||||||
let data = wsJsonToRes<GetCommunityResponse>(msg);
|
let data = wsJsonToRes<GetCommunityResponse>(msg);
|
||||||
let postRes = this.state.postRes;
|
let res = this.state.postRes;
|
||||||
if (postRes) {
|
if (res) {
|
||||||
postRes.community_view = data.community_view;
|
res.community_view = data.community_view;
|
||||||
postRes.post_view.community = data.community_view.community;
|
res.post_view.community = data.community_view.community;
|
||||||
postRes.moderators = data.moderators;
|
res.moderators = data.moderators;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
}
|
}
|
||||||
} else if (op == UserOperation.BlockPerson) {
|
} else if (op == UserOperation.BlockPerson) {
|
||||||
|
|
Loading…
Reference in a new issue