From 72cc633d18a458264e7db791c461d5a553e67f48 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Wed, 13 Nov 2019 11:46:52 -0500 Subject: [PATCH 1/2] Write shouldRenderInstanceContact method in About [HD-12 #start-progress] Signed-off-by: Marquis Kurt --- src/pages/About.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pages/About.tsx b/src/pages/About.tsx index 0be7b02..f2d1962 100644 --- a/src/pages/About.tsx +++ b/src/pages/About.tsx @@ -23,11 +23,9 @@ import AssignmentIcon from "@material-ui/icons/Assignment"; import AssignmentIndIcon from "@material-ui/icons/AssignmentInd"; import NetworkCheckIcon from "@material-ui/icons/NetworkCheck"; import UpdateIcon from "@material-ui/icons/Update"; -import InfoIcon from "@material-ui/icons/Info"; import NotesIcon from "@material-ui/icons/Notes"; import CodeIcon from "@material-ui/icons/Code"; import TicketAccountIcon from "mdi-material-ui/TicketAccount"; -import MastodonIcon from "mdi-material-ui/Mastodon"; import EditIcon from "@material-ui/icons/Edit"; import VpnKeyIcon from "@material-ui/icons/VpnKey"; @@ -107,8 +105,17 @@ class AboutPage extends Component { }); } + shouldRenderInstanceContact(): boolean { + if (this.state.instance != null) { + return this.state.instance.version.match(/Pleroma/) == null; + } else { + return false; + } + } + render() { const { classes } = this.props; + console.info(this.shouldRenderInstanceContact()); return (
@@ -297,7 +304,7 @@ class AboutPage extends Component {
- {localStorage["isPleroma"] == "false" && ( + {this.shouldRenderInstanceContact() ? ( { - )} + ) : null} From f9dd8a58011a58a602fe60e98350776f045a9582 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Wed, 13 Nov 2019 12:02:59 -0500 Subject: [PATCH 2/2] Remove isPleroma from localStorage, window reload on account storage change [HD-17] Signed-off-by: Marquis Kurt --- src/index.tsx | 6 ------ src/pages/About.tsx | 2 -- src/utilities/accounts.tsx | 6 ------ 3 files changed, 14 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index de1b2d1..22bb18e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -22,12 +22,6 @@ if (userLoggedIn()) { refreshUserAccountData(); } -window.onstorage = (event: any) => { - if (event.key == "account") { - window.location.reload(); - } -}; - ReactDOM.render( { render() { const { classes } = this.props; - console.info(this.shouldRenderInstanceContact()); - return (
diff --git a/src/utilities/accounts.tsx b/src/utilities/accounts.tsx index 3a6bcd0..da7b796 100644 --- a/src/utilities/accounts.tsx +++ b/src/utilities/accounts.tsx @@ -25,12 +25,6 @@ export function refreshUserAccountData() { .catch((err: Error) => { console.error(err.message); }); - client.get("/instance").then((resp: any) => { - localStorage.setItem( - "isPleroma", - resp.data.version.match(/Pleroma/) ? "true" : "false" - ); - }); } /**