From 4915193ae5c10cde92880d7559dea73a5b76db63 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 9 Jan 2022 12:53:11 -0500 Subject: [PATCH] Temp bans (#524) * Updating translations. * Adding temp bans. * Using new lemmy-js-client with temp bans * Fixing some lint and dep issues --- lemmy-translations | 2 +- package.json | 12 +- .../components/comment/comment-node.tsx | 37 +- src/shared/components/home/admin-settings.tsx | 39 +- src/shared/components/home/home.tsx | 13 - src/shared/components/post/post-listing.tsx | 34 +- src/shared/utils.ts | 22 + yarn.lock | 3211 +++++++---------- 8 files changed, 1363 insertions(+), 2007 deletions(-) diff --git a/lemmy-translations b/lemmy-translations index 1e0bb99..27a29ad 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit 1e0bb9920cda13bb128c87e85125b98ab8f319b6 +Subproject commit 27a29ad5411438e4792e8e298aa5f4a3b60bb908 diff --git a/package.json b/package.json index ba0665a..faa59bd 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@typescript-eslint/parser": "^5.6.0", "autosize": "^5.0.1", "check-password-strength": "^2.0.3", - "choices.js": "^9.0.1", + "choices.js": "^10.0.0", "emoji-short-name": "^1.0.0", "express": "~4.17.1", "i18next": "^21.5.4", @@ -41,6 +41,7 @@ "moment": "^2.29.1", "register-service-worker": "^1.7.2", "rxjs": "^7.4.0", + "sass": "^1.47.0", "serialize-javascript": "^6.0.0", "tippy.js": "^6.3.7", "toastify-js": "^1.11.2", @@ -51,12 +52,12 @@ "@babel/core": "^7.16.0", "@babel/plugin-transform-runtime": "^7.16.4", "@babel/plugin-transform-typescript": "^7.16.1", - "@babel/preset-env": "7.16.4", + "@babel/preset-env": "7.16.7", "@babel/preset-typescript": "^7.16.0", "@babel/runtime": "^7.16.3", "@types/autosize": "^4.0.0", "@types/express": "^4.17.13", - "@types/node": "^16.11.11", + "@types/node": "^17.0.8", "@types/node-fetch": "^2.5.11", "@types/serialize-javascript": "^5.0.1", "@typescript-eslint/eslint-plugin": "^5.6.0", @@ -72,11 +73,10 @@ "husky": "^7.0.4", "import-sort-style-module": "^6.0.0", "iso-639-1": "^2.1.10", - "lemmy-js-client": "0.15.0-rc.6", + "lemmy-js-client": "0.15.0-rc.34", "lint-staged": "^12.1.2", "mini-css-extract-plugin": "^2.4.5", "node-fetch": "^2.6.1", - "node-sass": "^7.0.0", "prettier": "^2.5.1", "prettier-plugin-import-sort": "^0.0.7", "prettier-plugin-organize-imports": "^2.3.4", @@ -90,7 +90,7 @@ "typescript": "^4.5.2", "webpack": "5.65.0", "webpack-cli": "^4.9.1", - "webpack-dev-server": "4.6.0", + "webpack-dev-server": "4.7.2", "webpack-node-externals": "^3.0.0" }, "engines": { diff --git a/src/shared/components/comment/comment-node.tsx b/src/shared/components/comment/comment-node.tsx index deea4b9..f40aa0a 100644 --- a/src/shared/components/comment/comment-node.tsx +++ b/src/shared/components/comment/comment-node.tsx @@ -28,7 +28,8 @@ import { authField, canMod, colorList, - getUnixTime, + futureDaysToUnixTime, + isBanned, isMod, mdToHtml, numToSI, @@ -51,7 +52,7 @@ interface CommentNodeState { showBanDialog: boolean; removeData: boolean; banReason: string; - banExpires: string; + banExpireDays: number; banType: BanType; showConfirmTransferSite: boolean; showConfirmTransferCommunity: boolean; @@ -96,7 +97,7 @@ export class CommentNode extends Component { showBanDialog: false, removeData: false, banReason: null, - banExpires: null, + banExpireDays: null, banType: BanType.Community, collapsed: false, viewSource: false, @@ -187,7 +188,7 @@ export class CommentNode extends Component { {i18n.t("bot_account").toLowerCase()} )} - {(cv.creator_banned_from_community || cv.creator.banned) && ( + {(cv.creator_banned_from_community || isBanned(cv.creator)) && (
{i18n.t("banned")}
@@ -614,7 +615,7 @@ export class CommentNode extends Component { {this.canAdmin && ( <> {!this.isAdmin && - (!cv.creator.banned ? ( + (!isBanned(cv.creator) ? ( ))} - {!cv.creator.banned && + {!isBanned(cv.creator) && cv.creator.local && (!this.state.showConfirmAppointAsAdmin ? ( ))} - {!post_view.creator.banned && post_view.creator.local && ( + {!isBanned(post_view.creator) && post_view.creator.local && (