From dc62eb5fc668a25f70a5d4cdec2529dcdf9c7895 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 21 Oct 2024 10:38:34 +0200 Subject: [PATCH] Revert "Adding ability to restore content on user unban. (#4845)" This reverts commit 76728776fd1efb1a0fea113f4203f02725404194. --- api_tests/package.json | 2 +- api_tests/pnpm-lock.yaml | 263 +++++++++--------- api_tests/src/post.spec.ts | 9 +- api_tests/src/shared.ts | 8 +- crates/api/src/community/ban.rs | 20 +- crates/api/src/lib.rs | 4 +- crates/api/src/local_user/ban_person.rs | 17 +- crates/api/src/site/purge/person.rs | 2 +- crates/api_common/src/community.rs | 4 +- crates/api_common/src/person.rs | 5 +- crates/api_common/src/send_activity.rs | 2 +- crates/api_common/src/utils.rs | 23 +- .../apub/src/activities/block/block_user.rs | 11 +- crates/apub/src/activities/block/mod.rs | 8 +- .../src/activities/block/undo_block_user.rs | 21 +- crates/apub/src/activities/mod.rs | 4 +- .../activities/block/undo_block_user.rs | 4 - 17 files changed, 168 insertions(+), 239 deletions(-) diff --git a/api_tests/package.json b/api_tests/package.json index cc58c83e9..bc2d3ec2d 100644 --- a/api_tests/package.json +++ b/api_tests/package.json @@ -27,7 +27,7 @@ "eslint": "^9.8.0", "eslint-plugin-prettier": "^5.1.3", "jest": "^29.5.0", - "lemmy-js-client": "0.20.0-alpha.4", + "lemmy-js-client": "0.19.5-alpha.1", "prettier": "^3.2.5", "ts-jest": "^29.1.0", "typescript": "^5.5.4", diff --git a/api_tests/pnpm-lock.yaml b/api_tests/pnpm-lock.yaml index 0b6a19f81..3b1970681 100644 --- a/api_tests/pnpm-lock.yaml +++ b/api_tests/pnpm-lock.yaml @@ -13,37 +13,37 @@ importers: version: 29.5.12 '@types/node': specifier: ^22.0.2 - version: 22.3.0 + version: 22.5.1 '@typescript-eslint/eslint-plugin': specifier: ^8.0.0 - version: 8.1.0(@typescript-eslint/parser@8.1.0(eslint@9.9.0)(typescript@5.5.4))(eslint@9.9.0)(typescript@5.5.4) + version: 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.9.1)(typescript@5.5.4))(eslint@9.9.1)(typescript@5.5.4) '@typescript-eslint/parser': specifier: ^8.0.0 - version: 8.1.0(eslint@9.9.0)(typescript@5.5.4) + version: 8.0.0(eslint@9.9.1)(typescript@5.5.4) eslint: specifier: ^9.8.0 - version: 9.9.0 + version: 9.9.1 eslint-plugin-prettier: specifier: ^5.1.3 - version: 5.2.1(eslint@9.9.0)(prettier@3.3.3) + version: 5.2.1(eslint@9.9.1)(prettier@3.3.3) jest: specifier: ^29.5.0 - version: 29.7.0(@types/node@22.3.0) + version: 29.7.0(@types/node@22.5.1) lemmy-js-client: - specifier: 0.20.0-alpha.4 - version: 0.20.0-alpha.4 + specifier: 0.19.5-alpha.1 + version: 0.19.5-alpha.1 prettier: specifier: ^3.2.5 version: 3.3.3 ts-jest: specifier: ^29.1.0 - version: 29.2.4(@babel/core@7.23.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.23.9))(jest@29.7.0(@types/node@22.3.0))(typescript@5.5.4) + version: 29.2.5(@babel/core@7.23.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.23.9))(jest@29.7.0(@types/node@22.5.1))(typescript@5.5.4) typescript: specifier: ^5.5.4 version: 5.5.4 typescript-eslint: specifier: ^8.0.0 - version: 8.1.0(eslint@9.9.0)(typescript@5.5.4) + version: 8.0.0(eslint@9.9.1)(typescript@5.5.4) packages: @@ -228,16 +228,16 @@ packages: resolution: {integrity: sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - '@eslint/config-array@0.17.1': - resolution: {integrity: sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==} + '@eslint/config-array@0.18.0': + resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/eslintrc@3.1.0': resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@9.9.0': - resolution: {integrity: sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug==} + '@eslint/js@9.9.1': + resolution: {integrity: sha512-xIDQRsfg5hNBqHz04H1R3scSVwmI+KUbqjsQKHKQ1DAUSaUjYPReZZmS/5PNiKu1fUvzDd6H7DEDKACSEhu+TQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/object-schema@2.1.4': @@ -396,8 +396,8 @@ packages: '@types/jest@29.5.12': resolution: {integrity: sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==} - '@types/node@22.3.0': - resolution: {integrity: sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g==} + '@types/node@22.5.1': + resolution: {integrity: sha512-KkHsxej0j9IW1KKOOAA/XBA0z08UFSrRQHErzEfA3Vgq57eXIMYboIlHJuYIfd+lwCQjtKqUu3UnmKbtUc9yRw==} '@types/stack-utils@2.0.3': resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} @@ -408,8 +408,8 @@ packages: '@types/yargs@17.0.32': resolution: {integrity: sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==} - '@typescript-eslint/eslint-plugin@8.1.0': - resolution: {integrity: sha512-LlNBaHFCEBPHyD4pZXb35mzjGkuGKXU5eeCA1SxvHfiRES0E82dOounfVpL4DCqYvJEKab0bZIA0gCRpdLKkCw==} + '@typescript-eslint/eslint-plugin@8.0.0': + resolution: {integrity: sha512-STIZdwEQRXAHvNUS6ILDf5z3u95Gc8jzywunxSNqX00OooIemaaNIA0vEgynJlycL5AjabYLLrIyHd4iazyvtg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 @@ -419,8 +419,8 @@ packages: typescript: optional: true - '@typescript-eslint/parser@8.1.0': - resolution: {integrity: sha512-U7iTAtGgJk6DPX9wIWPPOlt1gO57097G06gIcl0N0EEnNw8RGD62c+2/DiP/zL7KrkqnnqF7gtFGR7YgzPllTA==} + '@typescript-eslint/parser@8.0.0': + resolution: {integrity: sha512-pS1hdZ+vnrpDIxuFXYQpLTILglTjSYJ9MbetZctrUawogUsPdz31DIIRZ9+rab0LhYNTsk88w4fIzVheiTbWOQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -429,12 +429,12 @@ packages: typescript: optional: true - '@typescript-eslint/scope-manager@8.1.0': - resolution: {integrity: sha512-DsuOZQji687sQUjm4N6c9xABJa7fjvfIdjqpSIIVOgaENf2jFXiM9hIBZOL3hb6DHK9Nvd2d7zZnoMLf9e0OtQ==} + '@typescript-eslint/scope-manager@8.0.0': + resolution: {integrity: sha512-V0aa9Csx/ZWWv2IPgTfY7T4agYwJyILESu/PVqFtTFz9RIS823mAze+NbnBI8xiwdX3iqeQbcTYlvB04G9wyQw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.1.0': - resolution: {integrity: sha512-oLYvTxljVvsMnldfl6jIKxTaU7ok7km0KDrwOt1RHYu6nxlhN3TIx8k5Q52L6wR33nOwDgM7VwW1fT1qMNfFIA==} + '@typescript-eslint/type-utils@8.0.0': + resolution: {integrity: sha512-mJAFP2mZLTBwAn5WI4PMakpywfWFH5nQZezUQdSKV23Pqo6o9iShQg1hP2+0hJJXP2LnZkWPphdIq4juYYwCeg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -442,12 +442,12 @@ packages: typescript: optional: true - '@typescript-eslint/types@8.1.0': - resolution: {integrity: sha512-q2/Bxa0gMOu/2/AKALI0tCKbG2zppccnRIRCW6BaaTlRVaPKft4oVYPp7WOPpcnsgbr0qROAVCVKCvIQ0tbWog==} + '@typescript-eslint/types@8.0.0': + resolution: {integrity: sha512-wgdSGs9BTMWQ7ooeHtu5quddKKs5Z5dS+fHLbrQI+ID0XWJLODGMHRfhwImiHoeO2S5Wir2yXuadJN6/l4JRxw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.1.0': - resolution: {integrity: sha512-NTHhmufocEkMiAord/g++gWKb0Fr34e9AExBRdqgWdVBaKoei2dIyYKD9Q0jBnvfbEA5zaf8plUFMUH6kQ0vGg==} + '@typescript-eslint/typescript-estree@8.0.0': + resolution: {integrity: sha512-5b97WpKMX+Y43YKi4zVcCVLtK5F98dFls3Oxui8LbnmRsseKenbbDinmvxrWegKDMmlkIq/XHuyy0UGLtpCDKg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -455,14 +455,14 @@ packages: typescript: optional: true - '@typescript-eslint/utils@8.1.0': - resolution: {integrity: sha512-ypRueFNKTIFwqPeJBfeIpxZ895PQhNyH4YID6js0UoBImWYoSjBsahUn9KMiJXh94uOjVBgHD9AmkyPsPnFwJA==} + '@typescript-eslint/utils@8.0.0': + resolution: {integrity: sha512-k/oS/A/3QeGLRvOWCg6/9rATJL5rec7/5s1YmdS0ZU6LHveJyGFwBvLhSRBv6i9xaj7etmosp+l+ViN1I9Aj/Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 - '@typescript-eslint/visitor-keys@8.1.0': - resolution: {integrity: sha512-ba0lNI19awqZ5ZNKh6wCModMwoZs457StTebQ0q1NP58zSi2F6MOZRXwfKZy+jB78JNJ/WH8GSh2IQNzXX8Nag==} + '@typescript-eslint/visitor-keys@8.0.0': + resolution: {integrity: sha512-oN0K4nkHuOyF3PVMyETbpP5zp6wfyOvm7tWhTMfoqxSSsPmJIh6JNASuZDlODE8eE+0EB9uar+6+vxr9DBTYOA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} acorn-jsx@5.3.2: @@ -512,8 +512,8 @@ packages: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} - async@3.2.5: - resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==} + async@3.2.6: + resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} babel-jest@29.7.0: resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} @@ -741,8 +741,8 @@ packages: resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint@9.9.0: - resolution: {integrity: sha512-JfiKJrbx0506OEerjK2Y1QlldtBxkAlLxT5OEcRF8uaQ86noDe2k31Vw9rnSWv+MXZHj7OOUV/dA0AhdLFcyvA==} + eslint@9.9.1: + resolution: {integrity: sha512-dHvhrbfr4xFQ9/dq+jcVneZMyRYLjggWjk6RVsIiHsP8Rz6yZ8LvZ//iU4TrZF+SXWG+JkNF2OyiZRvzgRDqMg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true peerDependencies: @@ -916,6 +916,10 @@ packages: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} engines: {node: '>=10.17.0'} + ignore@5.3.1: + resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==} + engines: {node: '>= 4'} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -1175,8 +1179,8 @@ packages: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} - lemmy-js-client@0.20.0-alpha.4: - resolution: {integrity: sha512-MuVE8u/IFz59ks2vxOUXMRU8x6SIz3Keu4zRhmhNt+n+gI25JAggsTDrtxVCBtrqBhFEe+a3PdXdwm+fXbs0Dw==} + lemmy-js-client@0.19.5-alpha.1: + resolution: {integrity: sha512-GOhaiTQzrpwdmc3DFYemT2SmNmpuQJe2BWUms9QOzdYlkA1WZ0uu7axPE3s+T5OOxfy7K9Q2gsLe72dcVSlffw==} leven@3.1.0: resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} @@ -1408,11 +1412,6 @@ packages: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true - semver@7.6.2: - resolution: {integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==} - engines: {node: '>=10'} - hasBin: true - semver@7.6.3: resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} engines: {node: '>=10'} @@ -1518,8 +1517,8 @@ packages: peerDependencies: typescript: '>=4.2.0' - ts-jest@29.2.4: - resolution: {integrity: sha512-3d6tgDyhCI29HlpwIq87sNuI+3Q6GLTTCeYRHCs7vDz+/3GCMwEtV9jezLyl4ZtnBgx00I7hm8PCP8cTksMGrw==} + ts-jest@29.2.5: + resolution: {integrity: sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==} engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -1557,8 +1556,8 @@ packages: resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} engines: {node: '>=10'} - typescript-eslint@8.1.0: - resolution: {integrity: sha512-prB2U3jXPJLpo1iVLN338Lvolh6OrcCZO+9Yv6AR+tvegPPptYCDBIHiEEUdqRi8gAv2bXNKfMUrgAd2ejn/ow==} + typescript-eslint@8.0.0: + resolution: {integrity: sha512-yQWBJutWL1PmpmDddIOl9/Mi6vZjqNCjqSGBMQ4vsc2Aiodk0SnbQQWPXbSy0HNuKCuGkw1+u4aQ2mO40TdhDQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -1571,8 +1570,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - undici-types@6.18.2: - resolution: {integrity: sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ==} + undici-types@6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} update-browserslist-db@1.0.13: resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} @@ -1835,14 +1834,14 @@ snapshots: '@bcoe/v8-coverage@0.2.3': {} - '@eslint-community/eslint-utils@4.4.0(eslint@9.9.0)': + '@eslint-community/eslint-utils@4.4.0(eslint@9.9.1)': dependencies: - eslint: 9.9.0 + eslint: 9.9.1 eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.11.0': {} - '@eslint/config-array@0.17.1': + '@eslint/config-array@0.18.0': dependencies: '@eslint/object-schema': 2.1.4 debug: 4.3.6 @@ -1864,7 +1863,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.9.0': {} + '@eslint/js@9.9.1': {} '@eslint/object-schema@2.1.4': {} @@ -1885,7 +1884,7 @@ snapshots: '@jest/console@29.7.0': dependencies: '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -1898,14 +1897,14 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@22.3.0) + jest-config: 29.7.0(@types/node@22.5.1) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -1930,7 +1929,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 jest-mock: 29.7.0 '@jest/expect-utils@29.7.0': @@ -1948,7 +1947,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 22.3.0 + '@types/node': 22.5.1 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -1970,7 +1969,7 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.22 - '@types/node': 22.3.0 + '@types/node': 22.5.1 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -2040,7 +2039,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 22.3.0 + '@types/node': 22.5.1 '@types/yargs': 17.0.32 chalk: 4.1.2 @@ -2108,7 +2107,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 22.3.0 + '@types/node': 22.5.1 '@types/istanbul-lib-coverage@2.0.6': {} @@ -2125,9 +2124,9 @@ snapshots: expect: 29.7.0 pretty-format: 29.7.0 - '@types/node@22.3.0': + '@types/node@22.5.1': dependencies: - undici-types: 6.18.2 + undici-types: 6.19.8 '@types/stack-utils@2.0.3': {} @@ -2137,17 +2136,17 @@ snapshots: dependencies: '@types/yargs-parser': 21.0.3 - '@typescript-eslint/eslint-plugin@8.1.0(@typescript-eslint/parser@8.1.0(eslint@9.9.0)(typescript@5.5.4))(eslint@9.9.0)(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.9.1)(typescript@5.5.4))(eslint@9.9.1)(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.1.0(eslint@9.9.0)(typescript@5.5.4) - '@typescript-eslint/scope-manager': 8.1.0 - '@typescript-eslint/type-utils': 8.1.0(eslint@9.9.0)(typescript@5.5.4) - '@typescript-eslint/utils': 8.1.0(eslint@9.9.0)(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.1.0 - eslint: 9.9.0 + '@typescript-eslint/parser': 8.0.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.0.0 + '@typescript-eslint/type-utils': 8.0.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.0 + eslint: 9.9.1 graphemer: 1.4.0 - ignore: 5.3.2 + ignore: 5.3.1 natural-compare: 1.4.0 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: @@ -2155,28 +2154,28 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.1.0(eslint@9.9.0)(typescript@5.5.4)': + '@typescript-eslint/parser@8.0.0(eslint@9.9.1)(typescript@5.5.4)': dependencies: - '@typescript-eslint/scope-manager': 8.1.0 - '@typescript-eslint/types': 8.1.0 - '@typescript-eslint/typescript-estree': 8.1.0(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.1.0 + '@typescript-eslint/scope-manager': 8.0.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.0 debug: 4.3.6 - eslint: 9.9.0 + eslint: 9.9.1 optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.1.0': + '@typescript-eslint/scope-manager@8.0.0': dependencies: - '@typescript-eslint/types': 8.1.0 - '@typescript-eslint/visitor-keys': 8.1.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/visitor-keys': 8.0.0 - '@typescript-eslint/type-utils@8.1.0(eslint@9.9.0)(typescript@5.5.4)': + '@typescript-eslint/type-utils@8.0.0(eslint@9.9.1)(typescript@5.5.4)': dependencies: - '@typescript-eslint/typescript-estree': 8.1.0(typescript@5.5.4) - '@typescript-eslint/utils': 8.1.0(eslint@9.9.0)(typescript@5.5.4) + '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.9.1)(typescript@5.5.4) debug: 4.3.6 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: @@ -2185,12 +2184,12 @@ snapshots: - eslint - supports-color - '@typescript-eslint/types@8.1.0': {} + '@typescript-eslint/types@8.0.0': {} - '@typescript-eslint/typescript-estree@8.1.0(typescript@5.5.4)': + '@typescript-eslint/typescript-estree@8.0.0(typescript@5.5.4)': dependencies: - '@typescript-eslint/types': 8.1.0 - '@typescript-eslint/visitor-keys': 8.1.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/visitor-keys': 8.0.0 debug: 4.3.6 globby: 11.1.0 is-glob: 4.0.3 @@ -2202,20 +2201,20 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.1.0(eslint@9.9.0)(typescript@5.5.4)': + '@typescript-eslint/utils@8.0.0(eslint@9.9.1)(typescript@5.5.4)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.9.0) - '@typescript-eslint/scope-manager': 8.1.0 - '@typescript-eslint/types': 8.1.0 - '@typescript-eslint/typescript-estree': 8.1.0(typescript@5.5.4) - eslint: 9.9.0 + '@eslint-community/eslint-utils': 4.4.0(eslint@9.9.1) + '@typescript-eslint/scope-manager': 8.0.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) + eslint: 9.9.1 transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/visitor-keys@8.1.0': + '@typescript-eslint/visitor-keys@8.0.0': dependencies: - '@typescript-eslint/types': 8.1.0 + '@typescript-eslint/types': 8.0.0 eslint-visitor-keys: 3.4.3 acorn-jsx@5.3.2(acorn@8.12.1): @@ -2260,7 +2259,7 @@ snapshots: array-union@2.1.0: {} - async@3.2.5: {} + async@3.2.6: {} babel-jest@29.7.0(@babel/core@7.23.9): dependencies: @@ -2401,13 +2400,13 @@ snapshots: convert-source-map@2.0.0: {} - create-jest@29.7.0(@types/node@22.3.0): + create-jest@29.7.0(@types/node@22.5.1): dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@22.3.0) + jest-config: 29.7.0(@types/node@22.5.1) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -2462,9 +2461,9 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-plugin-prettier@5.2.1(eslint@9.9.0)(prettier@3.3.3): + eslint-plugin-prettier@5.2.1(eslint@9.9.1)(prettier@3.3.3): dependencies: - eslint: 9.9.0 + eslint: 9.9.1 prettier: 3.3.3 prettier-linter-helpers: 1.0.0 synckit: 0.9.1 @@ -2478,13 +2477,13 @@ snapshots: eslint-visitor-keys@4.0.0: {} - eslint@9.9.0: + eslint@9.9.1: dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.9.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.9.1) '@eslint-community/regexpp': 4.11.0 - '@eslint/config-array': 0.17.1 + '@eslint/config-array': 0.18.0 '@eslint/eslintrc': 3.1.0 - '@eslint/js': 9.9.0 + '@eslint/js': 9.9.1 '@humanwhocodes/module-importer': 1.0.1 '@humanwhocodes/retry': 0.3.0 '@nodelib/fs.walk': 1.2.8 @@ -2677,6 +2676,8 @@ snapshots: human-signals@2.1.0: {} + ignore@5.3.1: {} + ignore@5.3.2: {} import-fresh@3.3.0: @@ -2765,7 +2766,7 @@ snapshots: jake@10.9.2: dependencies: - async: 3.2.5 + async: 3.2.6 chalk: 4.1.2 filelist: 1.0.4 minimatch: 3.1.2 @@ -2782,7 +2783,7 @@ snapshots: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.1 @@ -2802,16 +2803,16 @@ snapshots: - babel-plugin-macros - supports-color - jest-cli@29.7.0(@types/node@22.3.0): + jest-cli@29.7.0(@types/node@22.5.1): dependencies: '@jest/core': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@22.3.0) + create-jest: 29.7.0(@types/node@22.5.1) exit: 0.1.2 import-local: 3.1.0 - jest-config: 29.7.0(@types/node@22.3.0) + jest-config: 29.7.0(@types/node@22.5.1) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -2821,7 +2822,7 @@ snapshots: - supports-color - ts-node - jest-config@29.7.0(@types/node@22.3.0): + jest-config@29.7.0(@types/node@22.5.1): dependencies: '@babel/core': 7.23.9 '@jest/test-sequencer': 29.7.0 @@ -2846,7 +2847,7 @@ snapshots: slash: 3.0.0 strip-json-comments: 3.1.1 optionalDependencies: - '@types/node': 22.3.0 + '@types/node': 22.5.1 transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -2875,7 +2876,7 @@ snapshots: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -2885,7 +2886,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 - '@types/node': 22.3.0 + '@types/node': 22.5.1 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -2924,7 +2925,7 @@ snapshots: jest-mock@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 jest-util: 29.7.0 jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): @@ -2959,7 +2960,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -2987,7 +2988,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 chalk: 4.1.2 cjs-module-lexer: 1.2.3 collect-v8-coverage: 1.0.2 @@ -3026,14 +3027,14 @@ snapshots: jest-util: 29.7.0 natural-compare: 1.4.0 pretty-format: 29.7.0 - semver: 7.6.2 + semver: 7.6.3 transitivePeerDependencies: - supports-color jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -3052,7 +3053,7 @@ snapshots: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.3.0 + '@types/node': 22.5.1 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -3061,17 +3062,17 @@ snapshots: jest-worker@29.7.0: dependencies: - '@types/node': 22.3.0 + '@types/node': 22.5.1 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - jest@29.7.0(@types/node@22.3.0): + jest@29.7.0(@types/node@22.5.1): dependencies: '@jest/core': 29.7.0 '@jest/types': 29.6.3 import-local: 3.1.0 - jest-cli: 29.7.0(@types/node@22.3.0) + jest-cli: 29.7.0(@types/node@22.5.1) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -3107,7 +3108,7 @@ snapshots: kleur@3.0.3: {} - lemmy-js-client@0.20.0-alpha.4: {} + lemmy-js-client@0.19.5-alpha.1: {} leven@3.1.0: {} @@ -3305,8 +3306,6 @@ snapshots: semver@6.3.1: {} - semver@7.6.2: {} - semver@7.6.3: {} shebang-command@2.0.0: @@ -3394,12 +3393,12 @@ snapshots: dependencies: typescript: 5.5.4 - ts-jest@29.2.4(@babel/core@7.23.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.23.9))(jest@29.7.0(@types/node@22.3.0))(typescript@5.5.4): + ts-jest@29.2.5(@babel/core@7.23.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.23.9))(jest@29.7.0(@types/node@22.5.1))(typescript@5.5.4): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@22.3.0) + jest: 29.7.0(@types/node@22.5.1) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 @@ -3423,11 +3422,11 @@ snapshots: type-fest@0.21.3: {} - typescript-eslint@8.1.0(eslint@9.9.0)(typescript@5.5.4): + typescript-eslint@8.0.0(eslint@9.9.1)(typescript@5.5.4): dependencies: - '@typescript-eslint/eslint-plugin': 8.1.0(@typescript-eslint/parser@8.1.0(eslint@9.9.0)(typescript@5.5.4))(eslint@9.9.0)(typescript@5.5.4) - '@typescript-eslint/parser': 8.1.0(eslint@9.9.0)(typescript@5.5.4) - '@typescript-eslint/utils': 8.1.0(eslint@9.9.0)(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.9.1)(typescript@5.5.4))(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.9.1)(typescript@5.5.4) optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: @@ -3436,7 +3435,7 @@ snapshots: typescript@5.5.4: {} - undici-types@6.18.2: {} + undici-types@6.19.8: {} update-browserslist-db@1.0.13(browserslist@4.22.3): dependencies: diff --git a/api_tests/src/post.spec.ts b/api_tests/src/post.spec.ts index e059d4585..6b5c8d812 100644 --- a/api_tests/src/post.spec.ts +++ b/api_tests/src/post.spec.ts @@ -502,17 +502,10 @@ test("Enforce site ban federation for local user", async () => { alpha, alphaPerson.person.id, false, - true, + false, ); expect(unBanAlpha.banned).toBe(false); - // existing alpha post should be restored on beta - betaBanRes = await waitUntil( - () => getPost(beta, searchBeta1.post.id), - s => !s.post_view.post.removed, - ); - expect(betaBanRes.post_view.post.removed).toBe(false); - // Login gets invalidated by ban, need to login again if (!alphaUserPerson) { throw "Missing alpha person"; diff --git a/api_tests/src/shared.ts b/api_tests/src/shared.ts index 84e0551a4..3ca37dac4 100644 --- a/api_tests/src/shared.ts +++ b/api_tests/src/shared.ts @@ -419,13 +419,13 @@ export async function banPersonFromSite( api: LemmyHttp, person_id: number, ban: boolean, - remove_or_restore_data: boolean, + remove_data: boolean, ): Promise { // Make sure lemmy-beta/c/main is cached on lemmy_alpha let form: BanPerson = { person_id, ban, - remove_or_restore_data, + remove_data, }; return api.banPerson(form); } @@ -434,13 +434,13 @@ export async function banPersonFromCommunity( api: LemmyHttp, person_id: number, community_id: number, - remove_or_restore_data: boolean, + remove_data: boolean, ban: boolean, ): Promise { let form: BanFromCommunity = { person_id, community_id, - remove_or_restore_data, + remove_data: remove_data, ban, }; return api.banFromCommunity(form); diff --git a/crates/api/src/community/ban.rs b/crates/api/src/community/ban.rs index d00a1b0d0..8e527d2ac 100644 --- a/crates/api/src/community/ban.rs +++ b/crates/api/src/community/ban.rs @@ -4,11 +4,7 @@ use lemmy_api_common::{ community::{BanFromCommunity, BanFromCommunityResponse}, context::LemmyContext, send_activity::{ActivityChannel, SendActivityData}, - utils::{ - check_community_mod_action, - check_expire_time, - remove_or_restore_user_data_in_community, - }, + utils::{check_community_mod_action, check_expire_time, remove_user_data_in_community}, }; use lemmy_db_schema::{ source::{ @@ -37,6 +33,7 @@ pub async fn ban_from_community( local_user_view: LocalUserView, ) -> LemmyResult> { let banned_person_id = data.person_id; + let remove_data = data.remove_data.unwrap_or(false); let expires = check_expire_time(data.expires)?; // Verify that only mods or admins can ban @@ -88,16 +85,9 @@ pub async fn ban_from_community( } // Remove/Restore their data if that's desired - if data.remove_or_restore_data.unwrap_or(false) { - let remove_data = data.ban; - remove_or_restore_user_data_in_community( - data.community_id, - banned_person_id, - remove_data, - &mut context.pool(), - ) - .await?; - }; + if remove_data { + remove_user_data_in_community(data.community_id, banned_person_id, &mut context.pool()).await?; + } // Mod tables let form = ModBanFromCommunityForm { diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs index 3cae4737a..2b8e12d37 100644 --- a/crates/api/src/lib.rs +++ b/crates/api/src/lib.rs @@ -172,7 +172,7 @@ pub(crate) async fn ban_nonlocal_user_from_local_communities( target: &Person, ban: bool, reason: &Option, - remove_or_restore_data: &Option, + remove_data: &Option, expires: &Option, context: &Data, ) -> LemmyResult<()> { @@ -230,7 +230,7 @@ pub(crate) async fn ban_nonlocal_user_from_local_communities( person_id: target.id, ban, reason: reason.clone(), - remove_or_restore_data: *remove_or_restore_data, + remove_data: *remove_data, expires: *expires, }; diff --git a/crates/api/src/local_user/ban_person.rs b/crates/api/src/local_user/ban_person.rs index bea8247a3..58392cefd 100644 --- a/crates/api/src/local_user/ban_person.rs +++ b/crates/api/src/local_user/ban_person.rs @@ -5,7 +5,7 @@ use lemmy_api_common::{ context::LemmyContext, person::{BanPerson, BanPersonResponse}, send_activity::{ActivityChannel, SendActivityData}, - utils::{check_expire_time, is_admin, remove_user_data, restore_user_data}, + utils::{check_expire_time, is_admin, remove_user_data}, }; use lemmy_db_schema::{ source::{ @@ -65,13 +65,10 @@ pub async fn ban_from_site( } // Remove their data if that's desired - if data.remove_or_restore_data.unwrap_or(false) { - if data.ban { - remove_user_data(person.id, &context).await?; - } else { - restore_user_data(person.id, &context).await?; - } - }; + let remove_data = data.remove_data.unwrap_or(false); + if remove_data { + remove_user_data(person.id, &context).await?; + } // Mod tables let form = ModBanForm { @@ -93,7 +90,7 @@ pub async fn ban_from_site( &person, data.ban, &data.reason, - &data.remove_or_restore_data, + &data.remove_data, &data.expires, &context, ) @@ -104,7 +101,7 @@ pub async fn ban_from_site( moderator: local_user_view.person, banned_user: person_view.person.clone(), reason: data.reason.clone(), - remove_or_restore_data: data.remove_or_restore_data, + remove_data: data.remove_data, ban: data.ban, expires: data.expires, }, diff --git a/crates/api/src/site/purge/person.rs b/crates/api/src/site/purge/person.rs index 1ce8bcd86..dc824b163 100644 --- a/crates/api/src/site/purge/person.rs +++ b/crates/api/src/site/purge/person.rs @@ -77,7 +77,7 @@ pub async fn purge_person( moderator: local_user_view.person, banned_user: person, reason: data.reason.clone(), - remove_or_restore_data: Some(true), + remove_data: Some(true), ban: true, expires: None, }, diff --git a/crates/api_common/src/community.rs b/crates/api_common/src/community.rs index 3dad04af5..9d306ff7a 100644 --- a/crates/api_common/src/community.rs +++ b/crates/api_common/src/community.rs @@ -97,9 +97,7 @@ pub struct BanFromCommunity { pub community_id: CommunityId, pub person_id: PersonId, pub ban: bool, - /// Optionally remove or restore all their data. Useful for new troll accounts. - /// If ban is true, then this means remove. If ban is false, it means restore. - pub remove_or_restore_data: Option, + pub remove_data: Option, pub reason: Option, /// A time that the ban will expire, in unix epoch seconds. /// diff --git a/crates/api_common/src/person.rs b/crates/api_common/src/person.rs index 93e0e24bb..f61f784c2 100644 --- a/crates/api_common/src/person.rs +++ b/crates/api_common/src/person.rs @@ -217,9 +217,8 @@ pub struct AddAdminResponse { pub struct BanPerson { pub person_id: PersonId, pub ban: bool, - /// Optionally remove or restore all their data. Useful for new troll accounts. - /// If ban is true, then this means remove. If ban is false, it means restore. - pub remove_or_restore_data: Option, + /// Optionally remove all their data. Useful for new troll accounts. + pub remove_data: Option, pub reason: Option, /// A time that the ban will expire, in unix epoch seconds. /// diff --git a/crates/api_common/src/send_activity.rs b/crates/api_common/src/send_activity.rs index 465e074f4..02518ca33 100644 --- a/crates/api_common/src/send_activity.rs +++ b/crates/api_common/src/send_activity.rs @@ -83,7 +83,7 @@ pub enum SendActivityData { moderator: Person, banned_user: Person, reason: Option, - remove_or_restore_data: Option, + remove_data: Option, ban: bool, expires: Option, }, diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index 63967d198..64cd41135 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -791,30 +791,13 @@ pub async fn remove_user_data( Ok(()) } -/// We can't restore their images, but we can unremove their posts and comments -pub async fn restore_user_data( - banned_person_id: PersonId, - context: &LemmyContext, -) -> LemmyResult<()> { - let pool = &mut context.pool(); - - // Posts - Post::update_removed_for_creator(pool, banned_person_id, None, false).await?; - - // Comments - Comment::update_removed_for_creator(pool, banned_person_id, false).await?; - - Ok(()) -} - -pub async fn remove_or_restore_user_data_in_community( +pub async fn remove_user_data_in_community( community_id: CommunityId, banned_person_id: PersonId, - remove: bool, pool: &mut DbPool<'_>, ) -> LemmyResult<()> { // Posts - Post::update_removed_for_creator(pool, banned_person_id, Some(community_id), remove).await?; + Post::update_removed_for_creator(pool, banned_person_id, Some(community_id), true).await?; // Comments // TODO Diesel doesn't allow updates with joins, so this has to be a loop @@ -832,7 +815,7 @@ pub async fn remove_or_restore_user_data_in_community( pool, comment_id, &CommentUpdateForm { - removed: Some(remove), + removed: Some(true), ..Default::default() }, ) diff --git a/crates/apub/src/activities/block/block_user.rs b/crates/apub/src/activities/block/block_user.rs index 4ee7b5383..48408c4fb 100644 --- a/crates/apub/src/activities/block/block_user.rs +++ b/crates/apub/src/activities/block/block_user.rs @@ -23,7 +23,7 @@ use anyhow::anyhow; use chrono::{DateTime, Utc}; use lemmy_api_common::{ context::LemmyContext, - utils::{remove_or_restore_user_data_in_community, remove_user_data}, + utils::{remove_user_data, remove_user_data_in_community}, }; use lemmy_db_schema::{ source::{ @@ -206,13 +206,8 @@ impl ActivityHandler for BlockUser { .ok(); if self.remove_data.unwrap_or(false) { - remove_or_restore_user_data_in_community( - community.id, - blocked_person.id, - true, - &mut context.pool(), - ) - .await?; + remove_user_data_in_community(community.id, blocked_person.id, &mut context.pool()) + .await?; } // write to mod log diff --git a/crates/apub/src/activities/block/mod.rs b/crates/apub/src/activities/block/mod.rs index 7484295cc..d42b62369 100644 --- a/crates/apub/src/activities/block/mod.rs +++ b/crates/apub/src/activities/block/mod.rs @@ -137,7 +137,7 @@ pub(crate) async fn send_ban_from_site( moderator: Person, banned_user: Person, reason: Option, - remove_or_restore_data: Option, + remove_data: Option, ban: bool, expires: Option, context: Data, @@ -158,7 +158,7 @@ pub(crate) async fn send_ban_from_site( &site, &banned_user.into(), &moderator.into(), - remove_or_restore_data.unwrap_or(false), + remove_data.unwrap_or(false), reason.clone(), expires, &context, @@ -169,7 +169,6 @@ pub(crate) async fn send_ban_from_site( &site, &banned_user.into(), &moderator.into(), - remove_or_restore_data.unwrap_or(false), reason.clone(), &context, ) @@ -198,7 +197,7 @@ pub(crate) async fn send_ban_from_community( &SiteOrCommunity::Community(community), &banned_person.into(), &mod_.into(), - data.remove_or_restore_data.unwrap_or(false), + data.remove_data.unwrap_or(false), data.reason.clone(), expires, &context, @@ -209,7 +208,6 @@ pub(crate) async fn send_ban_from_community( &SiteOrCommunity::Community(community), &banned_person.into(), &mod_.into(), - data.remove_or_restore_data.unwrap_or(false), data.reason.clone(), &context, ) diff --git a/crates/apub/src/activities/block/undo_block_user.rs b/crates/apub/src/activities/block/undo_block_user.rs index c01ad1e3e..b92320b2d 100644 --- a/crates/apub/src/activities/block/undo_block_user.rs +++ b/crates/apub/src/activities/block/undo_block_user.rs @@ -17,10 +17,7 @@ use activitypub_federation::{ protocol::verification::verify_domains_match, traits::{ActivityHandler, Actor}, }; -use lemmy_api_common::{ - context::LemmyContext, - utils::{remove_or_restore_user_data_in_community, restore_user_data}, -}; +use lemmy_api_common::context::LemmyContext; use lemmy_db_schema::{ source::{ activity::ActivitySendTargets, @@ -39,7 +36,6 @@ impl UndoBlockUser { target: &SiteOrCommunity, user: &ApubPerson, mod_: &ApubPerson, - restore_data: bool, reason: Option, context: &Data, ) -> LemmyResult<()> { @@ -62,7 +58,6 @@ impl UndoBlockUser { kind: UndoType::Undo, id: id.clone(), audience, - restore_data: Some(restore_data), }; let mut inboxes = ActivitySendTargets::to_inbox(user.shared_inbox_or_inbox()); @@ -119,10 +114,6 @@ impl ActivityHandler for UndoBlockUser { ) .await?; - if self.restore_data.unwrap_or(false) { - restore_user_data(blocked_person.id, context).await?; - } - // write mod log let form = ModBanForm { mod_person_id: mod_person.id, @@ -141,16 +132,6 @@ impl ActivityHandler for UndoBlockUser { }; CommunityPersonBan::unban(&mut context.pool(), &community_user_ban_form).await?; - if self.restore_data.unwrap_or(false) { - remove_or_restore_user_data_in_community( - community.id, - blocked_person.id, - false, - &mut context.pool(), - ) - .await?; - } - // write to mod log let form = ModBanFromCommunityForm { mod_person_id: mod_person.id, diff --git a/crates/apub/src/activities/mod.rs b/crates/apub/src/activities/mod.rs index b256a91f7..d81e7cabf 100644 --- a/crates/apub/src/activities/mod.rs +++ b/crates/apub/src/activities/mod.rs @@ -352,7 +352,7 @@ pub async fn match_outgoing_activities( moderator, banned_user, reason, - remove_or_restore_data, + remove_data, ban, expires, } => { @@ -360,7 +360,7 @@ pub async fn match_outgoing_activities( moderator, banned_user, reason, - remove_or_restore_data, + remove_data, ban, expires, context, diff --git a/crates/apub/src/protocol/activities/block/undo_block_user.rs b/crates/apub/src/protocol/activities/block/undo_block_user.rs index e038fa2dc..491ec7ed1 100644 --- a/crates/apub/src/protocol/activities/block/undo_block_user.rs +++ b/crates/apub/src/protocol/activities/block/undo_block_user.rs @@ -29,10 +29,6 @@ pub struct UndoBlockUser { pub(crate) kind: UndoType, pub(crate) id: Url, pub(crate) audience: Option>, - - /// Quick and dirty solution. - /// TODO: send a separate Delete activity instead - pub(crate) restore_data: Option, } #[async_trait::async_trait]