"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",
nsfw: false,
icon: null,
banner: null,
- auth: authField(),
+ auth: authField(false),
},
loading: false,
};
// 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();
community_id: null,
name: null,
nsfw: false,
- auth: authField(),
+ auth: authField(false),
},
loading: false,
imageLoading: false,
}
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
}));
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,
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,
};
// 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 {
}
userInfo() {
- let uv = this.state.userRes.user_view;
+ let uv = this.state.userRes?.user_view;
return (
<div>
}
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);
}
}
parseMessage(msg: any) {
- console.log(msg);
let op = wsUserOp(msg);
if (msg.error) {
toast(i18n.t(msg.error), 'danger');
// 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);
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];
}
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"