From 75d52f1e4e32d14e7ca7482e21213cc6d589f211 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 23 Jun 2022 10:05:56 -0400 Subject: [PATCH] Removing save and read config hjson. Fixes #695 (#696) --- package.json | 2 +- src/shared/components/community/community.tsx | 1 - src/shared/components/home/admin-settings.tsx | 110 +----------------- src/shared/components/home/home.tsx | 1 - src/shared/components/home/site-form.tsx | 2 +- src/shared/components/post/post.tsx | 1 - yarn.lock | 8 +- 7 files changed, 11 insertions(+), 114 deletions(-) diff --git a/package.json b/package.json index a643322..3fa26db 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "eslint-plugin-prettier": "^4.0.0", "husky": "^7.0.4", "import-sort-style-module": "^6.0.0", - "lemmy-js-client": "0.17.0-rc.31", + "lemmy-js-client": "0.17.0-rc.32", "lint-staged": "^12.4.1", "mini-css-extract-plugin": "^2.6.0", "node-fetch": "^2.6.1", diff --git a/src/shared/components/community/community.tsx b/src/shared/components/community/community.tsx index 732cba2..ab00af1 100644 --- a/src/shared/components/community/community.tsx +++ b/src/shared/components/community/community.tsx @@ -171,7 +171,6 @@ export class Community extends Component { componentWillUnmount() { saveScrollPosition(this.context); this.subscription.unsubscribe(); - window.isoData.path = undefined; } static getDerivedStateFromProps(props: any): CommunityProps { diff --git a/src/shared/components/home/admin-settings.tsx b/src/shared/components/home/admin-settings.tsx index 67a000c..e01a09d 100644 --- a/src/shared/components/home/admin-settings.tsx +++ b/src/shared/components/home/admin-settings.tsx @@ -1,16 +1,12 @@ -import { None, Option, Some } from "@sniptt/monads"; +import { None, Some } from "@sniptt/monads"; import autosize from "autosize"; import { Component, linkEvent } from "inferno"; import { BannedPersonsResponse, GetBannedPersons, - GetSiteConfig, - GetSiteConfigResponse, GetSiteResponse, PersonViewSafe, - SaveSiteConfig, SiteResponse, - toUndefined, UserOperation, wsJsonToRes, wsUserOp, @@ -37,29 +33,19 @@ import { SiteForm } from "./site-form"; interface AdminSettingsState { siteRes: GetSiteResponse; - siteConfigRes: Option; - siteConfigHjson: Option; banned: PersonViewSafe[]; loading: boolean; - siteConfigLoading: boolean; leaveAdminTeamLoading: boolean; } export class AdminSettings extends Component { private siteConfigTextAreaId = `site-config-${randomStr()}`; - private isoData = setIsoData( - this.context, - GetSiteConfigResponse, - BannedPersonsResponse - ); + private isoData = setIsoData(this.context, BannedPersonsResponse); private subscription: Subscription; private emptyState: AdminSettingsState = { siteRes: this.isoData.site_res, - siteConfigHjson: None, - siteConfigRes: None, banned: [], loading: true, - siteConfigLoading: null, leaveAdminTeamLoading: null, }; @@ -73,23 +59,11 @@ export class AdminSettings extends Component { // Only fetch the data if coming from another route if (this.isoData.path == this.context.router.route.match.url) { - this.state.siteConfigRes = Some( - this.isoData.routeData[0] as GetSiteConfigResponse - ); - this.state.siteConfigHjson = this.state.siteConfigRes.map( - s => s.config_hjson - ); this.state.banned = ( - this.isoData.routeData[1] as BannedPersonsResponse + this.isoData.routeData[0] as BannedPersonsResponse ).banned; - this.state.siteConfigLoading = false; this.state.loading = false; } else { - WebSocketService.Instance.send( - wsClient.getSiteConfig({ - auth: auth().unwrap(), - }) - ); WebSocketService.Instance.send( wsClient.getBannedPersons({ auth: auth().unwrap(), @@ -101,9 +75,6 @@ export class AdminSettings extends Component { static fetchInitialData(req: InitialFetchRequest): Promise[] { let promises: Promise[] = []; - let siteConfigForm = new GetSiteConfig({ auth: req.auth.unwrap() }); - promises.push(req.client.getSiteConfig(siteConfigForm)); - let bannedPersonsForm = new GetBannedPersons({ auth: req.auth.unwrap() }); promises.push(req.client.getBannedPersons(bannedPersonsForm)); @@ -155,10 +126,11 @@ export class AdminSettings extends Component { ), none: <>, })} + +
{this.admins()} {this.bannedUsers()}
-
{this.adminSettings()}
)} @@ -211,60 +183,6 @@ export class AdminSettings extends Component { ); } - adminSettings() { - return ( -
-
{i18n.t("admin_settings")}
-
-
- -
-