mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 06:36:17 +00:00
A few fixes.
This commit is contained in:
parent
368d4199a5
commit
325285951c
|
@ -67,7 +67,7 @@
|
|||
"eslint": "^7.16.0",
|
||||
"eslint-plugin-jane": "^9.0.6",
|
||||
"husky": "^4.3.6",
|
||||
"lemmy-js-client": "1.0.17-beta5",
|
||||
"lemmy-js-client": "1.0.17-beta6",
|
||||
"lint-staged": "^10.5.3",
|
||||
"mini-css-extract-plugin": "^1.3.3",
|
||||
"node-fetch": "^2.6.1",
|
||||
|
|
|
@ -54,7 +54,7 @@ export class CommunityForm extends Component<
|
|||
nsfw: false,
|
||||
icon: null,
|
||||
banner: null,
|
||||
auth: authField(),
|
||||
auth: authField(false),
|
||||
},
|
||||
loading: false,
|
||||
};
|
||||
|
|
|
@ -108,10 +108,9 @@ export class Inbox extends Component<any, InboxState> {
|
|||
|
||||
// Only fetch the data if coming from another route
|
||||
if (this.isoData.path == this.context.router.route.match.url) {
|
||||
this.state.replies = this.isoData.routeData[0].replies;
|
||||
this.state.mentions = this.isoData.routeData[1].mentions;
|
||||
this.state.messages = this.isoData.routeData[2].messages;
|
||||
this.sendUnreadCount();
|
||||
this.state.replies = this.isoData.routeData[0].replies || [];
|
||||
this.state.mentions = this.isoData.routeData[1].mentions || [];
|
||||
this.state.messages = this.isoData.routeData[2].messages || [];
|
||||
this.state.loading = false;
|
||||
} else {
|
||||
this.refetch();
|
||||
|
|
|
@ -78,7 +78,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
|||
community_id: null,
|
||||
name: null,
|
||||
nsfw: false,
|
||||
auth: authField(),
|
||||
auth: authField(false),
|
||||
},
|
||||
loading: false,
|
||||
imageLoading: false,
|
||||
|
|
|
@ -601,14 +601,16 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
}
|
||||
|
||||
duplicatesLine() {
|
||||
let dupes = this.props.duplicates;
|
||||
return (
|
||||
this.props.duplicates && (
|
||||
dupes &&
|
||||
dupes.length > 0 && (
|
||||
<ul class="list-inline mb-1 small text-muted">
|
||||
<>
|
||||
<li className="list-inline-item mr-2">
|
||||
{i18n.t('cross_posted_to')}
|
||||
</li>
|
||||
{this.props.duplicates.map(pv => (
|
||||
{dupes.map(pv => (
|
||||
<li className="list-inline-item mr-2">
|
||||
<Link to={`/post/${pv.post.id}`}>
|
||||
{pv.community.local
|
||||
|
|
|
@ -123,7 +123,7 @@ export class UserDetails extends Component<UserDetailsProps, UserDetailsState> {
|
|||
}));
|
||||
let posts: ItemType[] = this.props.userRes.posts.map(r => ({
|
||||
id: id++,
|
||||
type_: ItemEnum.Comment,
|
||||
type_: ItemEnum.Post,
|
||||
view: r,
|
||||
published: r.post.published,
|
||||
score: r.counts.score,
|
||||
|
|
|
@ -110,14 +110,14 @@ export class User extends Component<any, UserState> {
|
|||
send_notifications_to_email: null,
|
||||
bio: null,
|
||||
preferred_username: null,
|
||||
auth: authField(),
|
||||
auth: authField(false),
|
||||
},
|
||||
userSettingsLoading: null,
|
||||
deleteAccountLoading: null,
|
||||
deleteAccountShowConfirm: false,
|
||||
deleteAccountForm: {
|
||||
password: null,
|
||||
auth: authField(),
|
||||
auth: authField(false),
|
||||
},
|
||||
siteRes: this.isoData.site_res,
|
||||
};
|
||||
|
@ -150,6 +150,8 @@ export class User extends Component<any, UserState> {
|
|||
// Only fetch the data if coming from another route
|
||||
if (this.isoData.path == this.context.router.route.match.url) {
|
||||
this.state.userRes = this.isoData.routeData[0];
|
||||
this.state.userRes.user_view =
|
||||
this.state.userRes.user_view || this.state.userRes.user_view_dangerous;
|
||||
this.setUserInfo();
|
||||
this.state.loading = false;
|
||||
} else {
|
||||
|
@ -398,7 +400,7 @@ export class User extends Component<any, UserState> {
|
|||
}
|
||||
|
||||
userInfo() {
|
||||
let uv = this.state.userRes.user_view;
|
||||
let uv = this.state.userRes?.user_view;
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
@ -937,12 +939,16 @@ export class User extends Component<any, UserState> {
|
|||
}
|
||||
|
||||
handleUserSettingsSortTypeChange(val: SortType) {
|
||||
this.state.userSettingsForm.default_sort_type = val;
|
||||
this.state.userSettingsForm.default_sort_type = Object.keys(
|
||||
SortType
|
||||
).indexOf(val);
|
||||
this.setState(this.state);
|
||||
}
|
||||
|
||||
handleUserSettingsListingTypeChange(val: ListingType) {
|
||||
this.state.userSettingsForm.default_listing_type = val;
|
||||
this.state.userSettingsForm.default_listing_type = Object.keys(
|
||||
ListingType
|
||||
).indexOf(val);
|
||||
this.setState(this.state);
|
||||
}
|
||||
|
||||
|
@ -1081,7 +1087,6 @@ export class User extends Component<any, UserState> {
|
|||
}
|
||||
|
||||
parseMessage(msg: any) {
|
||||
console.log(msg);
|
||||
let op = wsUserOp(msg);
|
||||
if (msg.error) {
|
||||
toast(i18n.t(msg.error), 'danger');
|
||||
|
@ -1101,6 +1106,8 @@ export class User extends Component<any, UserState> {
|
|||
// TODO this might need to get abstracted
|
||||
let data = wsJsonToRes<GetUserDetailsResponse>(msg).data;
|
||||
this.state.userRes = data;
|
||||
this.state.userRes.user_view =
|
||||
this.state.userRes.user_view || this.state.userRes.user_view_dangerous;
|
||||
this.setUserInfo();
|
||||
this.state.loading = false;
|
||||
this.setState(this.state);
|
||||
|
|
|
@ -297,6 +297,14 @@ export function routeSortTypeToEnum(sort: string): SortType {
|
|||
return SortType[sort];
|
||||
}
|
||||
|
||||
export function listingTypeFromNum(type_: number): ListingType {
|
||||
return Object.values(ListingType)[type_];
|
||||
}
|
||||
|
||||
export function sortTypeFromNum(type_: number): SortType {
|
||||
return Object.values(SortType)[type_];
|
||||
}
|
||||
|
||||
export function routeListingTypeToEnum(type: string): ListingType {
|
||||
return ListingType[type];
|
||||
}
|
||||
|
|
|
@ -5555,10 +5555,10 @@ lcid@^1.0.0:
|
|||
dependencies:
|
||||
invert-kv "^1.0.0"
|
||||
|
||||
lemmy-js-client@1.0.17-beta5:
|
||||
version "1.0.17-beta5"
|
||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-1.0.17-beta5.tgz#b8d128ef3a6a17bc3ac4eea8e30618b68ea4f2df"
|
||||
integrity sha512-Z/8HV8tG9aB75GjDX1U2b3pFZnysGIymeVO+oepOkYfhHRB8SKmLS9ATuIw9OW1NjJduxbpGGgDH+bkf0Sx7dA==
|
||||
lemmy-js-client@1.0.17-beta6:
|
||||
version "1.0.17-beta6"
|
||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-1.0.17-beta6.tgz#afe1e1da13172a161c4d976b1ee58fe81eb22829"
|
||||
integrity sha512-+oX7J7wht8nH4a5NQngK1GNner3TDv6ZOhQQVI5KcK7vynVVIcgveC5KBJArHBAl5acXpLs3Khmx0ZEb+sErJA==
|
||||
|
||||
leven@^3.1.0:
|
||||
version "3.1.0"
|
||||
|
|
Loading…
Reference in a new issue