mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-15 14:35:54 +00:00
Adding Combined modlog (#5253)
* Combined tables try 2 * Finishing up combined report table. * Fix ts optionals. * Adding tests, triggers, and history updates for report_combined. * Adding profile. * Add cursor pagination to report_combined view (#5244) * add pagination cursor * store timestamp instead of id in cursor (partial) * Revert "store timestamp instead of id in cursor (partial)" This reverts commit89359dde4b
. * use paginated query builder * Fixing migration and paged API. * Using dullbananas trigger procedure * Removing pointless list routes, reorganizing tests. * Fixing column XOR check. * Forgot to remove list report actions. * Cleanup. * Use internal tagging. * Fixing api tests. * Adding a few indexes. * Fixing migration name. * Fixing unique constraints. * Addressing PR comments. * Start working on profile combined * Adding views and replaceable schema. * A few changes to profile view. - Separating the profile fetch from its combined content fetch. - Starting to separate saved_only into its own combined view. * Finishing up combined person_saved and person_content. * Fixing api tests. * Moving to api-v4 routes. * Fixing imports. * Update crates/db_views/src/report_combined_view.rs Co-authored-by: dullbananas <dull.bananas0@gmail.com> * Update crates/db_views/src/report_combined_view.rs Co-authored-by: dullbananas <dull.bananas0@gmail.com> * Update crates/db_views/src/report_combined_view.rs Co-authored-by: dullbananas <dull.bananas0@gmail.com> * Update migrations/2024-12-02-181601_add_report_combined_table/up.sql Co-authored-by: dullbananas <dull.bananas0@gmail.com> * Update migrations/2024-12-02-181601_add_report_combined_table/up.sql Co-authored-by: dullbananas <dull.bananas0@gmail.com> * Fixing import and fmt. * Fixing null types in postgres. * Comment out err. * Fixing TS issues. * Adding types, fixing allow and blocklist crud. * Starting to work on combined views. * Using dullbananas trigger procedure * Adding the full combined view queries. * Adding tests. * taplo fmt. * Upgrading package.json deps. * Updating pnpm * Addressing PR comments. * Removing serialization * Removing serialization * Fixing duped trigger. * Remove saved_only test. * Remove pointless post_tags types. * Remove pointless index. * Changing published to saved for person_saved_combined. * Removing comment. * Renaming modlog when_ columns to published. - Fixes #5312 * Adding strum and simplifying imports. * Avoiding clone in map_to_enum * Changing modded_person to other_person. * Update crates/db_views_moderator/src/modlog_combined_view.rs Co-authored-by: dullbananas <dull.bananas0@gmail.com> * Update crates/db_views_moderator/src/modlog_combined_view.rs Co-authored-by: dullbananas <dull.bananas0@gmail.com> * Update crates/db_views_moderator/src/modlog_combined_view.rs Co-authored-by: dullbananas <dull.bananas0@gmail.com> * Addressing PR comments. * Fixing split. * Revert "Adding strum and simplifying imports." This reverts commit15f1671107
. * Running fmt. * Using assert + matches instead of filter_map. * Adding listPersonContent check. --------- Co-authored-by: dullbananas <dull.bananas0@gmail.com>
This commit is contained in:
parent
da9582c80a
commit
9c1347c7a0
52 changed files with 2774 additions and 1963 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -2735,9 +2735,14 @@ version = "0.19.6-beta.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
|
"i-love-jesus",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
|
"lemmy_utils",
|
||||||
|
"pretty_assertions",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_with",
|
"serde_with",
|
||||||
|
"serial_test",
|
||||||
|
"tokio",
|
||||||
"ts-rs",
|
"ts-rs",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"repository": "https://github.com/LemmyNet/lemmy",
|
"repository": "https://github.com/LemmyNet/lemmy",
|
||||||
"author": "Dessalines",
|
"author": "Dessalines",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"packageManager": "pnpm@9.12.3",
|
"packageManager": "pnpm@9.15.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "tsc --noEmit && eslint --report-unused-disable-directives && prettier --check 'src/**/*.ts'",
|
"lint": "tsc --noEmit && eslint --report-unused-disable-directives && prettier --check 'src/**/*.ts'",
|
||||||
"fix": "prettier --write src && eslint --fix src",
|
"fix": "prettier --write src && eslint --fix src",
|
||||||
|
@ -22,16 +22,16 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.12",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/node": "^22.9.0",
|
"@types/node": "^22.10.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
||||||
"@typescript-eslint/parser": "^8.13.0",
|
"@typescript-eslint/parser": "^8.18.0",
|
||||||
"eslint": "^9.14.0",
|
"eslint": "^9.16.0",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
"lemmy-js-client": "0.20.0-image-api-rework.8",
|
"lemmy-js-client": "0.20.0-modlog-combined.0",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.4.2",
|
||||||
"ts-jest": "^29.1.0",
|
"ts-jest": "^29.1.0",
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.7.2",
|
||||||
"typescript-eslint": "^8.13.0"
|
"typescript-eslint": "^8.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,38 +12,38 @@ importers:
|
||||||
specifier: ^29.5.12
|
specifier: ^29.5.12
|
||||||
version: 29.5.14
|
version: 29.5.14
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^22.9.0
|
specifier: ^22.10.1
|
||||||
version: 22.9.0
|
version: 22.10.1
|
||||||
'@typescript-eslint/eslint-plugin':
|
'@typescript-eslint/eslint-plugin':
|
||||||
specifier: ^8.13.0
|
specifier: ^8.18.0
|
||||||
version: 8.13.0(@typescript-eslint/parser@8.13.0(eslint@9.14.0)(typescript@5.6.3))(eslint@9.14.0)(typescript@5.6.3)
|
version: 8.18.0(@typescript-eslint/parser@8.18.0(eslint@9.16.0)(typescript@5.7.2))(eslint@9.16.0)(typescript@5.7.2)
|
||||||
'@typescript-eslint/parser':
|
'@typescript-eslint/parser':
|
||||||
specifier: ^8.13.0
|
specifier: ^8.18.0
|
||||||
version: 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
version: 8.18.0(eslint@9.16.0)(typescript@5.7.2)
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^9.14.0
|
specifier: ^9.16.0
|
||||||
version: 9.14.0
|
version: 9.16.0
|
||||||
eslint-plugin-prettier:
|
eslint-plugin-prettier:
|
||||||
specifier: ^5.1.3
|
specifier: ^5.1.3
|
||||||
version: 5.2.1(eslint@9.14.0)(prettier@3.3.3)
|
version: 5.2.1(eslint@9.16.0)(prettier@3.4.2)
|
||||||
jest:
|
jest:
|
||||||
specifier: ^29.5.0
|
specifier: ^29.5.0
|
||||||
version: 29.7.0(@types/node@22.9.0)
|
version: 29.7.0(@types/node@22.10.1)
|
||||||
lemmy-js-client:
|
lemmy-js-client:
|
||||||
specifier: 0.20.0-image-api-rework.8
|
specifier: 0.20.0-modlog-combined.0
|
||||||
version: 0.20.0-image-api-rework.8
|
version: 0.20.0-modlog-combined.0
|
||||||
prettier:
|
prettier:
|
||||||
specifier: ^3.2.5
|
specifier: ^3.4.2
|
||||||
version: 3.3.3
|
version: 3.4.2
|
||||||
ts-jest:
|
ts-jest:
|
||||||
specifier: ^29.1.0
|
specifier: ^29.1.0
|
||||||
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.9.0))(typescript@5.6.3)
|
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.10.1))(typescript@5.7.2)
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.5.4
|
specifier: ^5.7.2
|
||||||
version: 5.6.3
|
version: 5.7.2
|
||||||
typescript-eslint:
|
typescript-eslint:
|
||||||
specifier: ^8.13.0
|
specifier: ^8.18.0
|
||||||
version: 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
version: 8.18.0(eslint@9.16.0)(typescript@5.7.2)
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
|
@ -228,28 +228,28 @@ packages:
|
||||||
resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==}
|
resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==}
|
||||||
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
|
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
|
||||||
|
|
||||||
'@eslint/config-array@0.18.0':
|
'@eslint/config-array@0.19.1':
|
||||||
resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==}
|
resolution: {integrity: sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@eslint/core@0.7.0':
|
'@eslint/core@0.9.1':
|
||||||
resolution: {integrity: sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw==}
|
resolution: {integrity: sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@eslint/eslintrc@3.1.0':
|
'@eslint/eslintrc@3.2.0':
|
||||||
resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==}
|
resolution: {integrity: sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@eslint/js@9.14.0':
|
'@eslint/js@9.16.0':
|
||||||
resolution: {integrity: sha512-pFoEtFWCPyDOl+C6Ift+wC7Ro89otjigCf5vcuWqWgqNSQbRrpjSvdeE6ofLz4dHmyxD5f7gIdGT4+p36L6Twg==}
|
resolution: {integrity: sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@eslint/object-schema@2.1.4':
|
'@eslint/object-schema@2.1.5':
|
||||||
resolution: {integrity: sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==}
|
resolution: {integrity: sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@eslint/plugin-kit@0.2.2':
|
'@eslint/plugin-kit@0.2.4':
|
||||||
resolution: {integrity: sha512-CXtq5nR4Su+2I47WPOlWud98Y5Lv8Kyxp2ukhgFx/eW6Blm18VXJO5WuQylPugRo8nbluoi6GvvxBLqHcvqUUw==}
|
resolution: {integrity: sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@humanfs/core@0.19.1':
|
'@humanfs/core@0.19.1':
|
||||||
|
@ -422,8 +422,8 @@ packages:
|
||||||
'@types/json-schema@7.0.15':
|
'@types/json-schema@7.0.15':
|
||||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||||
|
|
||||||
'@types/node@22.9.0':
|
'@types/node@22.10.1':
|
||||||
resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==}
|
resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==}
|
||||||
|
|
||||||
'@types/stack-utils@2.0.3':
|
'@types/stack-utils@2.0.3':
|
||||||
resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==}
|
resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==}
|
||||||
|
@ -434,61 +434,51 @@ packages:
|
||||||
'@types/yargs@17.0.32':
|
'@types/yargs@17.0.32':
|
||||||
resolution: {integrity: sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==}
|
resolution: {integrity: sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==}
|
||||||
|
|
||||||
'@typescript-eslint/eslint-plugin@8.13.0':
|
'@typescript-eslint/eslint-plugin@8.18.0':
|
||||||
resolution: {integrity: sha512-nQtBLiZYMUPkclSeC3id+x4uVd1SGtHuElTxL++SfP47jR0zfkZBJHc+gL4qPsgTuypz0k8Y2GheaDYn6Gy3rg==}
|
resolution: {integrity: sha512-NR2yS7qUqCL7AIxdJUQf2MKKNDVNaig/dEB0GBLU7D+ZdHgK1NoH/3wsgO3OnPVipn51tG3MAwaODEGil70WEw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0
|
'@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0
|
||||||
eslint: ^8.57.0 || ^9.0.0
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
typescript: '*'
|
typescript: '>=4.8.4 <5.8.0'
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript-eslint/parser@8.13.0':
|
'@typescript-eslint/parser@8.18.0':
|
||||||
resolution: {integrity: sha512-w0xp+xGg8u/nONcGw1UXAr6cjCPU1w0XVyBs6Zqaj5eLmxkKQAByTdV/uGgNN5tVvN/kKpoQlP2cL7R+ajZZIQ==}
|
resolution: {integrity: sha512-hgUZ3kTEpVzKaK3uNibExUYm6SKKOmTU2BOxBSvOYwtJEPdVQ70kZJpPjstlnhCHcuc2WGfSbpKlb/69ttyN5Q==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^8.57.0 || ^9.0.0
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
typescript: '*'
|
typescript: '>=4.8.4 <5.8.0'
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript-eslint/scope-manager@8.13.0':
|
'@typescript-eslint/scope-manager@8.18.0':
|
||||||
resolution: {integrity: sha512-XsGWww0odcUT0gJoBZ1DeulY1+jkaHUciUq4jKNv4cpInbvvrtDoyBH9rE/n2V29wQJPk8iCH1wipra9BhmiMA==}
|
resolution: {integrity: sha512-PNGcHop0jkK2WVYGotk/hxj+UFLhXtGPiGtiaWgVBVP1jhMoMCHlTyJA+hEj4rszoSdLTK3fN4oOatrL0Cp+Xw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@typescript-eslint/type-utils@8.13.0':
|
'@typescript-eslint/type-utils@8.18.0':
|
||||||
resolution: {integrity: sha512-Rqnn6xXTR316fP4D2pohZenJnp+NwQ1mo7/JM+J1LWZENSLkJI8ID8QNtlvFeb0HnFSK94D6q0cnMX6SbE5/vA==}
|
resolution: {integrity: sha512-er224jRepVAVLnMF2Q7MZJCq5CsdH2oqjP4dT7K6ij09Kyd+R21r7UVJrF0buMVdZS5QRhDzpvzAxHxabQadow==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
|
||||||
peerDependencies:
|
|
||||||
typescript: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript-eslint/types@8.13.0':
|
|
||||||
resolution: {integrity: sha512-4cyFErJetFLckcThRUFdReWJjVsPCqyBlJTi6IDEpc1GWCIIZRFxVppjWLIMcQhNGhdWJJRYFHpHoDWvMlDzng==}
|
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
|
||||||
|
|
||||||
'@typescript-eslint/typescript-estree@8.13.0':
|
|
||||||
resolution: {integrity: sha512-v7SCIGmVsRK2Cy/LTLGN22uea6SaUIlpBcO/gnMGT/7zPtxp90bphcGf4fyrCQl3ZtiBKqVTG32hb668oIYy1g==}
|
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
|
||||||
peerDependencies:
|
|
||||||
typescript: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript-eslint/utils@8.13.0':
|
|
||||||
resolution: {integrity: sha512-A1EeYOND6Uv250nybnLZapeXpYMl8tkzYUxqmoKAWnI4sei3ihf2XdZVd+vVOmHGcp3t+P7yRrNsyyiXTvShFQ==}
|
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^8.57.0 || ^9.0.0
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
|
typescript: '>=4.8.4 <5.8.0'
|
||||||
|
|
||||||
'@typescript-eslint/visitor-keys@8.13.0':
|
'@typescript-eslint/types@8.18.0':
|
||||||
resolution: {integrity: sha512-7N/+lztJqH4Mrf0lb10R/CbI1EaAMMGyF5y0oJvFoAhafwgiRA7TXyd8TFn8FC8k5y2dTsYogg238qavRGNnlw==}
|
resolution: {integrity: sha512-FNYxgyTCAnFwTrzpBGq+zrnoTO4x0c1CKYY5MuUTzpScqmY5fmsh2o3+57lqdI3NZucBDCzDgdEbIaNfAjAHQA==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
|
'@typescript-eslint/typescript-estree@8.18.0':
|
||||||
|
resolution: {integrity: sha512-rqQgFRu6yPkauz+ms3nQpohwejS8bvgbPyIDq13cgEDbkXt4LH4OkDMT0/fN1RUtzG8e8AKJyDBoocuQh8qNeg==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=4.8.4 <5.8.0'
|
||||||
|
|
||||||
|
'@typescript-eslint/utils@8.18.0':
|
||||||
|
resolution: {integrity: sha512-p6GLdY383i7h5b0Qrfbix3Vc3+J2k6QWw6UMUeY5JGfm3C5LbZ4QIZzJNoNOfgyRe0uuYKjvVOsO/jD4SJO+xg==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
|
typescript: '>=4.8.4 <5.8.0'
|
||||||
|
|
||||||
|
'@typescript-eslint/visitor-keys@8.18.0':
|
||||||
|
resolution: {integrity: sha512-pCh/qEA8Lb1wVIqNvBke8UaRjJ6wrAWkJO5yyIbs8Yx6TNGYyfNjOo61tLv+WwLvoLPp4BQ8B7AHKijl8NGUfw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
acorn-jsx@5.3.2:
|
acorn-jsx@5.3.2:
|
||||||
|
@ -666,6 +656,15 @@ packages:
|
||||||
supports-color:
|
supports-color:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
debug@4.4.0:
|
||||||
|
resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==}
|
||||||
|
engines: {node: '>=6.0'}
|
||||||
|
peerDependencies:
|
||||||
|
supports-color: '*'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
supports-color:
|
||||||
|
optional: true
|
||||||
|
|
||||||
dedent@1.5.1:
|
dedent@1.5.1:
|
||||||
resolution: {integrity: sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==}
|
resolution: {integrity: sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@ -745,8 +744,8 @@ packages:
|
||||||
resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==}
|
resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
eslint@9.14.0:
|
eslint@9.16.0:
|
||||||
resolution: {integrity: sha512-c2FHsVBr87lnUtjP4Yhvk4yEhKrQavGafRA/Se1ouse8PfbfC/Qh9Mxa00yWsZRlqeUB9raXip0aiiUZkgnr9g==}
|
resolution: {integrity: sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@ -1167,8 +1166,8 @@ packages:
|
||||||
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
|
|
||||||
lemmy-js-client@0.20.0-image-api-rework.8:
|
lemmy-js-client@0.20.0-modlog-combined.0:
|
||||||
resolution: {integrity: sha512-Ns/ayfCSm2lHbdAU1tGIZSx6kJ2ZeS7UiXlPuH0IzHQSi8Yuyzj3srDCyHpE6Td3pmXbQlt9N1ziPE4KeRJ3CA==}
|
resolution: {integrity: sha512-lb3na39klOSE184hJJObMufKjHtm3Mrk42RHqyVNCYZQ+FAAbQzBFTuYyqv8QJV5TJlMmyFO2v1v/9cH72nLRg==}
|
||||||
|
|
||||||
leven@3.1.0:
|
leven@3.1.0:
|
||||||
resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
|
resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
|
||||||
|
@ -1335,8 +1334,8 @@ packages:
|
||||||
resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==}
|
resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==}
|
||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
|
|
||||||
prettier@3.3.3:
|
prettier@3.4.2:
|
||||||
resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==}
|
resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
@ -1482,9 +1481,6 @@ packages:
|
||||||
resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==}
|
resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
text-table@0.2.0:
|
|
||||||
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
|
|
||||||
|
|
||||||
tmpl@1.0.5:
|
tmpl@1.0.5:
|
||||||
resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==}
|
resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==}
|
||||||
|
|
||||||
|
@ -1502,6 +1498,12 @@ packages:
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.2.0'
|
typescript: '>=4.2.0'
|
||||||
|
|
||||||
|
ts-api-utils@1.4.3:
|
||||||
|
resolution: {integrity: sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==}
|
||||||
|
engines: {node: '>=16'}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=4.2.0'
|
||||||
|
|
||||||
ts-jest@29.2.5:
|
ts-jest@29.2.5:
|
||||||
resolution: {integrity: sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==}
|
resolution: {integrity: sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==}
|
||||||
engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0}
|
engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0}
|
||||||
|
@ -1541,22 +1543,20 @@ packages:
|
||||||
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
|
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
typescript-eslint@8.13.0:
|
typescript-eslint@8.18.0:
|
||||||
resolution: {integrity: sha512-vIMpDRJrQd70au2G8w34mPps0ezFSPMEX4pXkTzUkrNbRX+36ais2ksGWN0esZL+ZMaFJEneOBHzCgSqle7DHw==}
|
resolution: {integrity: sha512-Xq2rRjn6tzVpAyHr3+nmSg1/9k9aIHnJ2iZeOH7cfGOWqTkXTm3kwpQglEuLGdNrYvPF+2gtAs+/KF5rjVo+WQ==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '*'
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
peerDependenciesMeta:
|
typescript: '>=4.8.4 <5.8.0'
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
typescript@5.6.3:
|
typescript@5.7.2:
|
||||||
resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==}
|
resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==}
|
||||||
engines: {node: '>=14.17'}
|
engines: {node: '>=14.17'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
undici-types@6.19.8:
|
undici-types@6.20.0:
|
||||||
resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
|
resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==}
|
||||||
|
|
||||||
update-browserslist-db@1.0.13:
|
update-browserslist-db@1.0.13:
|
||||||
resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==}
|
resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==}
|
||||||
|
@ -1816,24 +1816,26 @@ snapshots:
|
||||||
|
|
||||||
'@bcoe/v8-coverage@0.2.3': {}
|
'@bcoe/v8-coverage@0.2.3': {}
|
||||||
|
|
||||||
'@eslint-community/eslint-utils@4.4.1(eslint@9.14.0)':
|
'@eslint-community/eslint-utils@4.4.1(eslint@9.16.0)':
|
||||||
dependencies:
|
dependencies:
|
||||||
eslint: 9.14.0
|
eslint: 9.16.0
|
||||||
eslint-visitor-keys: 3.4.3
|
eslint-visitor-keys: 3.4.3
|
||||||
|
|
||||||
'@eslint-community/regexpp@4.12.1': {}
|
'@eslint-community/regexpp@4.12.1': {}
|
||||||
|
|
||||||
'@eslint/config-array@0.18.0':
|
'@eslint/config-array@0.19.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint/object-schema': 2.1.4
|
'@eslint/object-schema': 2.1.5
|
||||||
debug: 4.3.7
|
debug: 4.3.7
|
||||||
minimatch: 3.1.2
|
minimatch: 3.1.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@eslint/core@0.7.0': {}
|
'@eslint/core@0.9.1':
|
||||||
|
dependencies:
|
||||||
|
'@types/json-schema': 7.0.15
|
||||||
|
|
||||||
'@eslint/eslintrc@3.1.0':
|
'@eslint/eslintrc@3.2.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
ajv: 6.12.6
|
ajv: 6.12.6
|
||||||
debug: 4.3.7
|
debug: 4.3.7
|
||||||
|
@ -1847,11 +1849,11 @@ snapshots:
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@eslint/js@9.14.0': {}
|
'@eslint/js@9.16.0': {}
|
||||||
|
|
||||||
'@eslint/object-schema@2.1.4': {}
|
'@eslint/object-schema@2.1.5': {}
|
||||||
|
|
||||||
'@eslint/plugin-kit@0.2.2':
|
'@eslint/plugin-kit@0.2.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
levn: 0.4.1
|
levn: 0.4.1
|
||||||
|
|
||||||
|
@ -1881,7 +1883,7 @@ snapshots:
|
||||||
'@jest/console@29.7.0':
|
'@jest/console@29.7.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
jest-message-util: 29.7.0
|
jest-message-util: 29.7.0
|
||||||
jest-util: 29.7.0
|
jest-util: 29.7.0
|
||||||
|
@ -1894,14 +1896,14 @@ snapshots:
|
||||||
'@jest/test-result': 29.7.0
|
'@jest/test-result': 29.7.0
|
||||||
'@jest/transform': 29.7.0
|
'@jest/transform': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
ansi-escapes: 4.3.2
|
ansi-escapes: 4.3.2
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
ci-info: 3.9.0
|
ci-info: 3.9.0
|
||||||
exit: 0.1.2
|
exit: 0.1.2
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
jest-changed-files: 29.7.0
|
jest-changed-files: 29.7.0
|
||||||
jest-config: 29.7.0(@types/node@22.9.0)
|
jest-config: 29.7.0(@types/node@22.10.1)
|
||||||
jest-haste-map: 29.7.0
|
jest-haste-map: 29.7.0
|
||||||
jest-message-util: 29.7.0
|
jest-message-util: 29.7.0
|
||||||
jest-regex-util: 29.6.3
|
jest-regex-util: 29.6.3
|
||||||
|
@ -1926,7 +1928,7 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/fake-timers': 29.7.0
|
'@jest/fake-timers': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
jest-mock: 29.7.0
|
jest-mock: 29.7.0
|
||||||
|
|
||||||
'@jest/expect-utils@29.7.0':
|
'@jest/expect-utils@29.7.0':
|
||||||
|
@ -1944,7 +1946,7 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@sinonjs/fake-timers': 10.3.0
|
'@sinonjs/fake-timers': 10.3.0
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
jest-message-util: 29.7.0
|
jest-message-util: 29.7.0
|
||||||
jest-mock: 29.7.0
|
jest-mock: 29.7.0
|
||||||
jest-util: 29.7.0
|
jest-util: 29.7.0
|
||||||
|
@ -1966,7 +1968,7 @@ snapshots:
|
||||||
'@jest/transform': 29.7.0
|
'@jest/transform': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@jridgewell/trace-mapping': 0.3.22
|
'@jridgewell/trace-mapping': 0.3.22
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
collect-v8-coverage: 1.0.2
|
collect-v8-coverage: 1.0.2
|
||||||
exit: 0.1.2
|
exit: 0.1.2
|
||||||
|
@ -2036,7 +2038,7 @@ snapshots:
|
||||||
'@jest/schemas': 29.6.3
|
'@jest/schemas': 29.6.3
|
||||||
'@types/istanbul-lib-coverage': 2.0.6
|
'@types/istanbul-lib-coverage': 2.0.6
|
||||||
'@types/istanbul-reports': 3.0.4
|
'@types/istanbul-reports': 3.0.4
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
'@types/yargs': 17.0.32
|
'@types/yargs': 17.0.32
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
|
|
||||||
|
@ -2106,7 +2108,7 @@ snapshots:
|
||||||
|
|
||||||
'@types/graceful-fs@4.1.9':
|
'@types/graceful-fs@4.1.9':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
|
|
||||||
'@types/istanbul-lib-coverage@2.0.6': {}
|
'@types/istanbul-lib-coverage@2.0.6': {}
|
||||||
|
|
||||||
|
@ -2125,9 +2127,9 @@ snapshots:
|
||||||
|
|
||||||
'@types/json-schema@7.0.15': {}
|
'@types/json-schema@7.0.15': {}
|
||||||
|
|
||||||
'@types/node@22.9.0':
|
'@types/node@22.10.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: 6.19.8
|
undici-types: 6.20.0
|
||||||
|
|
||||||
'@types/stack-utils@2.0.3': {}
|
'@types/stack-utils@2.0.3': {}
|
||||||
|
|
||||||
|
@ -2137,86 +2139,82 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/yargs-parser': 21.0.3
|
'@types/yargs-parser': 21.0.3
|
||||||
|
|
||||||
'@typescript-eslint/eslint-plugin@8.13.0(@typescript-eslint/parser@8.13.0(eslint@9.14.0)(typescript@5.6.3))(eslint@9.14.0)(typescript@5.6.3)':
|
'@typescript-eslint/eslint-plugin@8.18.0(@typescript-eslint/parser@8.18.0(eslint@9.16.0)(typescript@5.7.2))(eslint@9.16.0)(typescript@5.7.2)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/regexpp': 4.12.1
|
'@eslint-community/regexpp': 4.12.1
|
||||||
'@typescript-eslint/parser': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
'@typescript-eslint/parser': 8.18.0(eslint@9.16.0)(typescript@5.7.2)
|
||||||
'@typescript-eslint/scope-manager': 8.13.0
|
'@typescript-eslint/scope-manager': 8.18.0
|
||||||
'@typescript-eslint/type-utils': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
'@typescript-eslint/type-utils': 8.18.0(eslint@9.16.0)(typescript@5.7.2)
|
||||||
'@typescript-eslint/utils': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
'@typescript-eslint/utils': 8.18.0(eslint@9.16.0)(typescript@5.7.2)
|
||||||
'@typescript-eslint/visitor-keys': 8.13.0
|
'@typescript-eslint/visitor-keys': 8.18.0
|
||||||
eslint: 9.14.0
|
eslint: 9.16.0
|
||||||
graphemer: 1.4.0
|
graphemer: 1.4.0
|
||||||
ignore: 5.3.2
|
ignore: 5.3.2
|
||||||
natural-compare: 1.4.0
|
natural-compare: 1.4.0
|
||||||
ts-api-utils: 1.4.0(typescript@5.6.3)
|
ts-api-utils: 1.4.0(typescript@5.7.2)
|
||||||
optionalDependencies:
|
typescript: 5.7.2
|
||||||
typescript: 5.6.3
|
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/parser@8.13.0(eslint@9.14.0)(typescript@5.6.3)':
|
'@typescript-eslint/parser@8.18.0(eslint@9.16.0)(typescript@5.7.2)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/scope-manager': 8.13.0
|
'@typescript-eslint/scope-manager': 8.18.0
|
||||||
'@typescript-eslint/types': 8.13.0
|
'@typescript-eslint/types': 8.18.0
|
||||||
'@typescript-eslint/typescript-estree': 8.13.0(typescript@5.6.3)
|
'@typescript-eslint/typescript-estree': 8.18.0(typescript@5.7.2)
|
||||||
'@typescript-eslint/visitor-keys': 8.13.0
|
'@typescript-eslint/visitor-keys': 8.18.0
|
||||||
debug: 4.3.7
|
debug: 4.3.7
|
||||||
eslint: 9.14.0
|
eslint: 9.16.0
|
||||||
optionalDependencies:
|
typescript: 5.7.2
|
||||||
typescript: 5.6.3
|
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/scope-manager@8.13.0':
|
'@typescript-eslint/scope-manager@8.18.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.13.0
|
'@typescript-eslint/types': 8.18.0
|
||||||
'@typescript-eslint/visitor-keys': 8.13.0
|
'@typescript-eslint/visitor-keys': 8.18.0
|
||||||
|
|
||||||
'@typescript-eslint/type-utils@8.13.0(eslint@9.14.0)(typescript@5.6.3)':
|
'@typescript-eslint/type-utils@8.18.0(eslint@9.16.0)(typescript@5.7.2)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/typescript-estree': 8.13.0(typescript@5.6.3)
|
'@typescript-eslint/typescript-estree': 8.18.0(typescript@5.7.2)
|
||||||
'@typescript-eslint/utils': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
'@typescript-eslint/utils': 8.18.0(eslint@9.16.0)(typescript@5.7.2)
|
||||||
debug: 4.3.7
|
debug: 4.4.0
|
||||||
ts-api-utils: 1.4.0(typescript@5.6.3)
|
eslint: 9.16.0
|
||||||
optionalDependencies:
|
ts-api-utils: 1.4.0(typescript@5.7.2)
|
||||||
typescript: 5.6.3
|
typescript: 5.7.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- eslint
|
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/types@8.13.0': {}
|
'@typescript-eslint/types@8.18.0': {}
|
||||||
|
|
||||||
'@typescript-eslint/typescript-estree@8.13.0(typescript@5.6.3)':
|
'@typescript-eslint/typescript-estree@8.18.0(typescript@5.7.2)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.13.0
|
'@typescript-eslint/types': 8.18.0
|
||||||
'@typescript-eslint/visitor-keys': 8.13.0
|
'@typescript-eslint/visitor-keys': 8.18.0
|
||||||
debug: 4.3.7
|
debug: 4.3.7
|
||||||
fast-glob: 3.3.2
|
fast-glob: 3.3.2
|
||||||
is-glob: 4.0.3
|
is-glob: 4.0.3
|
||||||
minimatch: 9.0.5
|
minimatch: 9.0.5
|
||||||
semver: 7.6.3
|
semver: 7.6.3
|
||||||
ts-api-utils: 1.4.0(typescript@5.6.3)
|
ts-api-utils: 1.4.3(typescript@5.7.2)
|
||||||
optionalDependencies:
|
typescript: 5.7.2
|
||||||
typescript: 5.6.3
|
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/utils@8.13.0(eslint@9.14.0)(typescript@5.6.3)':
|
'@typescript-eslint/utils@8.18.0(eslint@9.16.0)(typescript@5.7.2)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.14.0)
|
'@eslint-community/eslint-utils': 4.4.1(eslint@9.16.0)
|
||||||
'@typescript-eslint/scope-manager': 8.13.0
|
'@typescript-eslint/scope-manager': 8.18.0
|
||||||
'@typescript-eslint/types': 8.13.0
|
'@typescript-eslint/types': 8.18.0
|
||||||
'@typescript-eslint/typescript-estree': 8.13.0(typescript@5.6.3)
|
'@typescript-eslint/typescript-estree': 8.18.0(typescript@5.7.2)
|
||||||
eslint: 9.14.0
|
eslint: 9.16.0
|
||||||
|
typescript: 5.7.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
- typescript
|
|
||||||
|
|
||||||
'@typescript-eslint/visitor-keys@8.13.0':
|
'@typescript-eslint/visitor-keys@8.18.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.13.0
|
'@typescript-eslint/types': 8.18.0
|
||||||
eslint-visitor-keys: 3.4.3
|
eslint-visitor-keys: 4.2.0
|
||||||
|
|
||||||
acorn-jsx@5.3.2(acorn@8.14.0):
|
acorn-jsx@5.3.2(acorn@8.14.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -2383,13 +2381,13 @@ snapshots:
|
||||||
|
|
||||||
convert-source-map@2.0.0: {}
|
convert-source-map@2.0.0: {}
|
||||||
|
|
||||||
create-jest@29.7.0(@types/node@22.9.0):
|
create-jest@29.7.0(@types/node@22.10.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
exit: 0.1.2
|
exit: 0.1.2
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
jest-config: 29.7.0(@types/node@22.9.0)
|
jest-config: 29.7.0(@types/node@22.10.1)
|
||||||
jest-util: 29.7.0
|
jest-util: 29.7.0
|
||||||
prompts: 2.4.2
|
prompts: 2.4.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
@ -2414,6 +2412,10 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
ms: 2.1.3
|
ms: 2.1.3
|
||||||
|
|
||||||
|
debug@4.4.0:
|
||||||
|
dependencies:
|
||||||
|
ms: 2.1.3
|
||||||
|
|
||||||
dedent@1.5.1: {}
|
dedent@1.5.1: {}
|
||||||
|
|
||||||
deep-is@0.1.4: {}
|
deep-is@0.1.4: {}
|
||||||
|
@ -2444,10 +2446,10 @@ snapshots:
|
||||||
|
|
||||||
escape-string-regexp@4.0.0: {}
|
escape-string-regexp@4.0.0: {}
|
||||||
|
|
||||||
eslint-plugin-prettier@5.2.1(eslint@9.14.0)(prettier@3.3.3):
|
eslint-plugin-prettier@5.2.1(eslint@9.16.0)(prettier@3.4.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
eslint: 9.14.0
|
eslint: 9.16.0
|
||||||
prettier: 3.3.3
|
prettier: 3.4.2
|
||||||
prettier-linter-helpers: 1.0.0
|
prettier-linter-helpers: 1.0.0
|
||||||
synckit: 0.9.1
|
synckit: 0.9.1
|
||||||
|
|
||||||
|
@ -2460,15 +2462,15 @@ snapshots:
|
||||||
|
|
||||||
eslint-visitor-keys@4.2.0: {}
|
eslint-visitor-keys@4.2.0: {}
|
||||||
|
|
||||||
eslint@9.14.0:
|
eslint@9.16.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.14.0)
|
'@eslint-community/eslint-utils': 4.4.1(eslint@9.16.0)
|
||||||
'@eslint-community/regexpp': 4.12.1
|
'@eslint-community/regexpp': 4.12.1
|
||||||
'@eslint/config-array': 0.18.0
|
'@eslint/config-array': 0.19.1
|
||||||
'@eslint/core': 0.7.0
|
'@eslint/core': 0.9.1
|
||||||
'@eslint/eslintrc': 3.1.0
|
'@eslint/eslintrc': 3.2.0
|
||||||
'@eslint/js': 9.14.0
|
'@eslint/js': 9.16.0
|
||||||
'@eslint/plugin-kit': 0.2.2
|
'@eslint/plugin-kit': 0.2.4
|
||||||
'@humanfs/node': 0.16.6
|
'@humanfs/node': 0.16.6
|
||||||
'@humanwhocodes/module-importer': 1.0.1
|
'@humanwhocodes/module-importer': 1.0.1
|
||||||
'@humanwhocodes/retry': 0.4.1
|
'@humanwhocodes/retry': 0.4.1
|
||||||
|
@ -2496,7 +2498,6 @@ snapshots:
|
||||||
minimatch: 3.1.2
|
minimatch: 3.1.2
|
||||||
natural-compare: 1.4.0
|
natural-compare: 1.4.0
|
||||||
optionator: 0.9.4
|
optionator: 0.9.4
|
||||||
text-table: 0.2.0
|
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
@ -2752,7 +2753,7 @@ snapshots:
|
||||||
'@jest/expect': 29.7.0
|
'@jest/expect': 29.7.0
|
||||||
'@jest/test-result': 29.7.0
|
'@jest/test-result': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
co: 4.6.0
|
co: 4.6.0
|
||||||
dedent: 1.5.1
|
dedent: 1.5.1
|
||||||
|
@ -2772,16 +2773,16 @@ snapshots:
|
||||||
- babel-plugin-macros
|
- babel-plugin-macros
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
jest-cli@29.7.0(@types/node@22.9.0):
|
jest-cli@29.7.0(@types/node@22.10.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/core': 29.7.0
|
'@jest/core': 29.7.0
|
||||||
'@jest/test-result': 29.7.0
|
'@jest/test-result': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
create-jest: 29.7.0(@types/node@22.9.0)
|
create-jest: 29.7.0(@types/node@22.10.1)
|
||||||
exit: 0.1.2
|
exit: 0.1.2
|
||||||
import-local: 3.1.0
|
import-local: 3.1.0
|
||||||
jest-config: 29.7.0(@types/node@22.9.0)
|
jest-config: 29.7.0(@types/node@22.10.1)
|
||||||
jest-util: 29.7.0
|
jest-util: 29.7.0
|
||||||
jest-validate: 29.7.0
|
jest-validate: 29.7.0
|
||||||
yargs: 17.7.2
|
yargs: 17.7.2
|
||||||
|
@ -2791,7 +2792,7 @@ snapshots:
|
||||||
- supports-color
|
- supports-color
|
||||||
- ts-node
|
- ts-node
|
||||||
|
|
||||||
jest-config@29.7.0(@types/node@22.9.0):
|
jest-config@29.7.0(@types/node@22.10.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/core': 7.23.9
|
'@babel/core': 7.23.9
|
||||||
'@jest/test-sequencer': 29.7.0
|
'@jest/test-sequencer': 29.7.0
|
||||||
|
@ -2816,7 +2817,7 @@ snapshots:
|
||||||
slash: 3.0.0
|
slash: 3.0.0
|
||||||
strip-json-comments: 3.1.1
|
strip-json-comments: 3.1.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- babel-plugin-macros
|
- babel-plugin-macros
|
||||||
- supports-color
|
- supports-color
|
||||||
|
@ -2845,7 +2846,7 @@ snapshots:
|
||||||
'@jest/environment': 29.7.0
|
'@jest/environment': 29.7.0
|
||||||
'@jest/fake-timers': 29.7.0
|
'@jest/fake-timers': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
jest-mock: 29.7.0
|
jest-mock: 29.7.0
|
||||||
jest-util: 29.7.0
|
jest-util: 29.7.0
|
||||||
|
|
||||||
|
@ -2855,7 +2856,7 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/graceful-fs': 4.1.9
|
'@types/graceful-fs': 4.1.9
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
anymatch: 3.1.3
|
anymatch: 3.1.3
|
||||||
fb-watchman: 2.0.2
|
fb-watchman: 2.0.2
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
|
@ -2894,7 +2895,7 @@ snapshots:
|
||||||
jest-mock@29.7.0:
|
jest-mock@29.7.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
jest-util: 29.7.0
|
jest-util: 29.7.0
|
||||||
|
|
||||||
jest-pnp-resolver@1.2.3(jest-resolve@29.7.0):
|
jest-pnp-resolver@1.2.3(jest-resolve@29.7.0):
|
||||||
|
@ -2929,7 +2930,7 @@ snapshots:
|
||||||
'@jest/test-result': 29.7.0
|
'@jest/test-result': 29.7.0
|
||||||
'@jest/transform': 29.7.0
|
'@jest/transform': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
emittery: 0.13.1
|
emittery: 0.13.1
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
|
@ -2957,7 +2958,7 @@ snapshots:
|
||||||
'@jest/test-result': 29.7.0
|
'@jest/test-result': 29.7.0
|
||||||
'@jest/transform': 29.7.0
|
'@jest/transform': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
cjs-module-lexer: 1.2.3
|
cjs-module-lexer: 1.2.3
|
||||||
collect-v8-coverage: 1.0.2
|
collect-v8-coverage: 1.0.2
|
||||||
|
@ -3003,7 +3004,7 @@ snapshots:
|
||||||
jest-util@29.7.0:
|
jest-util@29.7.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
ci-info: 3.9.0
|
ci-info: 3.9.0
|
||||||
graceful-fs: 4.2.11
|
graceful-fs: 4.2.11
|
||||||
|
@ -3022,7 +3023,7 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/test-result': 29.7.0
|
'@jest/test-result': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
ansi-escapes: 4.3.2
|
ansi-escapes: 4.3.2
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
emittery: 0.13.1
|
emittery: 0.13.1
|
||||||
|
@ -3031,17 +3032,17 @@ snapshots:
|
||||||
|
|
||||||
jest-worker@29.7.0:
|
jest-worker@29.7.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.9.0
|
'@types/node': 22.10.1
|
||||||
jest-util: 29.7.0
|
jest-util: 29.7.0
|
||||||
merge-stream: 2.0.0
|
merge-stream: 2.0.0
|
||||||
supports-color: 8.1.1
|
supports-color: 8.1.1
|
||||||
|
|
||||||
jest@29.7.0(@types/node@22.9.0):
|
jest@29.7.0(@types/node@22.10.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/core': 29.7.0
|
'@jest/core': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
import-local: 3.1.0
|
import-local: 3.1.0
|
||||||
jest-cli: 29.7.0(@types/node@22.9.0)
|
jest-cli: 29.7.0(@types/node@22.10.1)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@types/node'
|
- '@types/node'
|
||||||
- babel-plugin-macros
|
- babel-plugin-macros
|
||||||
|
@ -3077,7 +3078,7 @@ snapshots:
|
||||||
|
|
||||||
kleur@3.0.3: {}
|
kleur@3.0.3: {}
|
||||||
|
|
||||||
lemmy-js-client@0.20.0-image-api-rework.8: {}
|
lemmy-js-client@0.20.0-modlog-combined.0: {}
|
||||||
|
|
||||||
leven@3.1.0: {}
|
leven@3.1.0: {}
|
||||||
|
|
||||||
|
@ -3226,7 +3227,7 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
fast-diff: 1.3.0
|
fast-diff: 1.3.0
|
||||||
|
|
||||||
prettier@3.3.3: {}
|
prettier@3.4.2: {}
|
||||||
|
|
||||||
pretty-format@29.7.0:
|
pretty-format@29.7.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -3344,8 +3345,6 @@ snapshots:
|
||||||
glob: 7.2.3
|
glob: 7.2.3
|
||||||
minimatch: 3.1.2
|
minimatch: 3.1.2
|
||||||
|
|
||||||
text-table@0.2.0: {}
|
|
||||||
|
|
||||||
tmpl@1.0.5: {}
|
tmpl@1.0.5: {}
|
||||||
|
|
||||||
to-fast-properties@2.0.0: {}
|
to-fast-properties@2.0.0: {}
|
||||||
|
@ -3354,22 +3353,26 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-number: 7.0.0
|
is-number: 7.0.0
|
||||||
|
|
||||||
ts-api-utils@1.4.0(typescript@5.6.3):
|
ts-api-utils@1.4.0(typescript@5.7.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
typescript: 5.6.3
|
typescript: 5.7.2
|
||||||
|
|
||||||
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.9.0))(typescript@5.6.3):
|
ts-api-utils@1.4.3(typescript@5.7.2):
|
||||||
|
dependencies:
|
||||||
|
typescript: 5.7.2
|
||||||
|
|
||||||
|
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.10.1))(typescript@5.7.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
bs-logger: 0.2.6
|
bs-logger: 0.2.6
|
||||||
ejs: 3.1.10
|
ejs: 3.1.10
|
||||||
fast-json-stable-stringify: 2.1.0
|
fast-json-stable-stringify: 2.1.0
|
||||||
jest: 29.7.0(@types/node@22.9.0)
|
jest: 29.7.0(@types/node@22.10.1)
|
||||||
jest-util: 29.7.0
|
jest-util: 29.7.0
|
||||||
json5: 2.2.3
|
json5: 2.2.3
|
||||||
lodash.memoize: 4.1.2
|
lodash.memoize: 4.1.2
|
||||||
make-error: 1.3.6
|
make-error: 1.3.6
|
||||||
semver: 7.6.3
|
semver: 7.6.3
|
||||||
typescript: 5.6.3
|
typescript: 5.7.2
|
||||||
yargs-parser: 21.1.1
|
yargs-parser: 21.1.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@babel/core': 7.23.9
|
'@babel/core': 7.23.9
|
||||||
|
@ -3387,20 +3390,19 @@ snapshots:
|
||||||
|
|
||||||
type-fest@0.21.3: {}
|
type-fest@0.21.3: {}
|
||||||
|
|
||||||
typescript-eslint@8.13.0(eslint@9.14.0)(typescript@5.6.3):
|
typescript-eslint@8.18.0(eslint@9.16.0)(typescript@5.7.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/eslint-plugin': 8.13.0(@typescript-eslint/parser@8.13.0(eslint@9.14.0)(typescript@5.6.3))(eslint@9.14.0)(typescript@5.6.3)
|
'@typescript-eslint/eslint-plugin': 8.18.0(@typescript-eslint/parser@8.18.0(eslint@9.16.0)(typescript@5.7.2))(eslint@9.16.0)(typescript@5.7.2)
|
||||||
'@typescript-eslint/parser': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
'@typescript-eslint/parser': 8.18.0(eslint@9.16.0)(typescript@5.7.2)
|
||||||
'@typescript-eslint/utils': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
'@typescript-eslint/utils': 8.18.0(eslint@9.16.0)(typescript@5.7.2)
|
||||||
optionalDependencies:
|
eslint: 9.16.0
|
||||||
typescript: 5.6.3
|
typescript: 5.7.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- eslint
|
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
typescript@5.6.3: {}
|
typescript@5.7.2: {}
|
||||||
|
|
||||||
undici-types@6.19.8: {}
|
undici-types@6.20.0: {}
|
||||||
|
|
||||||
update-browserslist-db@1.0.13(browserslist@4.22.3):
|
update-browserslist-db@1.0.13(browserslist@4.22.3):
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
@ -27,7 +27,6 @@ import {
|
||||||
getComments,
|
getComments,
|
||||||
getCommentParentId,
|
getCommentParentId,
|
||||||
resolveCommunity,
|
resolveCommunity,
|
||||||
getPersonDetails,
|
|
||||||
getReplies,
|
getReplies,
|
||||||
getUnreadCount,
|
getUnreadCount,
|
||||||
waitUntil,
|
waitUntil,
|
||||||
|
@ -38,6 +37,7 @@ import {
|
||||||
delay,
|
delay,
|
||||||
saveUserSettings,
|
saveUserSettings,
|
||||||
listReports,
|
listReports,
|
||||||
|
listPersonContent,
|
||||||
} from "./shared";
|
} from "./shared";
|
||||||
import {
|
import {
|
||||||
CommentReportView,
|
CommentReportView,
|
||||||
|
@ -210,11 +210,13 @@ test.skip("Remove a comment from admin and community on the same instance", asyn
|
||||||
expect(removeCommentRes.comment_view.comment.removed).toBe(true);
|
expect(removeCommentRes.comment_view.comment.removed).toBe(true);
|
||||||
|
|
||||||
// Make sure that comment is removed on alpha (it gets pushed since an admin from beta removed it)
|
// Make sure that comment is removed on alpha (it gets pushed since an admin from beta removed it)
|
||||||
let refetchedPostComments = await getPersonDetails(
|
let refetchedPostComments = await listPersonContent(
|
||||||
alpha,
|
alpha,
|
||||||
commentRes.comment_view.comment.creator_id,
|
commentRes.comment_view.comment.creator_id,
|
||||||
|
"Comments",
|
||||||
);
|
);
|
||||||
expect(refetchedPostComments.comments[0].comment.removed).toBe(true);
|
let firstRefetchedComment = refetchedPostComments.content[0] as CommentView;
|
||||||
|
expect(firstRefetchedComment.comment.removed).toBe(true);
|
||||||
|
|
||||||
// beta will unremove the comment
|
// beta will unremove the comment
|
||||||
let unremoveCommentRes = await removeComment(beta, false, betaCommentId);
|
let unremoveCommentRes = await removeComment(beta, false, betaCommentId);
|
||||||
|
|
|
@ -23,6 +23,9 @@ import {
|
||||||
PrivateMessageReportResponse,
|
PrivateMessageReportResponse,
|
||||||
SuccessResponse,
|
SuccessResponse,
|
||||||
UserBlockInstanceParams,
|
UserBlockInstanceParams,
|
||||||
|
ListPersonContentResponse,
|
||||||
|
ListPersonContent,
|
||||||
|
PersonContentType,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { CreatePost } from "lemmy-js-client/dist/types/CreatePost";
|
import { CreatePost } from "lemmy-js-client/dist/types/CreatePost";
|
||||||
import { DeletePost } from "lemmy-js-client/dist/types/DeletePost";
|
import { DeletePost } from "lemmy-js-client/dist/types/DeletePost";
|
||||||
|
@ -207,7 +210,7 @@ async function allowInstance(api: LemmyHttp, instance: string) {
|
||||||
// Ignore errors from duplicate allows (because setup gets called for each test file)
|
// Ignore errors from duplicate allows (because setup gets called for each test file)
|
||||||
try {
|
try {
|
||||||
await api.adminAllowInstance(params);
|
await api.adminAllowInstance(params);
|
||||||
} catch (error) {
|
} catch {
|
||||||
// console.error(error);
|
// console.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -735,6 +738,7 @@ export async function saveUserSettings(
|
||||||
): Promise<SuccessResponse> {
|
): Promise<SuccessResponse> {
|
||||||
return api.saveUserSettings(form);
|
return api.saveUserSettings(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPersonDetails(
|
export async function getPersonDetails(
|
||||||
api: LemmyHttp,
|
api: LemmyHttp,
|
||||||
person_id: number,
|
person_id: number,
|
||||||
|
@ -745,6 +749,18 @@ export async function getPersonDetails(
|
||||||
return api.getPersonDetails(form);
|
return api.getPersonDetails(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function listPersonContent(
|
||||||
|
api: LemmyHttp,
|
||||||
|
person_id: number,
|
||||||
|
type_?: PersonContentType,
|
||||||
|
): Promise<ListPersonContentResponse> {
|
||||||
|
let form: ListPersonContent = {
|
||||||
|
person_id,
|
||||||
|
type_,
|
||||||
|
};
|
||||||
|
return api.listPersonContent(form);
|
||||||
|
}
|
||||||
|
|
||||||
export async function deleteUser(api: LemmyHttp): Promise<SuccessResponse> {
|
export async function deleteUser(api: LemmyHttp): Promise<SuccessResponse> {
|
||||||
let form: DeleteAccount = {
|
let form: DeleteAccount = {
|
||||||
delete_content: true,
|
delete_content: true,
|
||||||
|
|
|
@ -75,7 +75,6 @@ test("Delete user", async () => {
|
||||||
let user = await registerUser(alpha, alphaUrl);
|
let user = await registerUser(alpha, alphaUrl);
|
||||||
let user_profile = await getMyUser(user);
|
let user_profile = await getMyUser(user);
|
||||||
let person_id = user_profile.local_user_view.person.id;
|
let person_id = user_profile.local_user_view.person.id;
|
||||||
let actor_id = user_profile.local_user_view.person.actor_id;
|
|
||||||
|
|
||||||
// make a local post and comment
|
// make a local post and comment
|
||||||
let alphaCommunity = (await resolveCommunity(user, "main@lemmy-alpha:8541"))
|
let alphaCommunity = (await resolveCommunity(user, "main@lemmy-alpha:8541"))
|
||||||
|
|
|
@ -60,8 +60,8 @@ pub async fn feature_post(
|
||||||
let form = ModFeaturePostForm {
|
let form = ModFeaturePostForm {
|
||||||
mod_person_id: local_user_view.person.id,
|
mod_person_id: local_user_view.person.id,
|
||||||
post_id: data.post_id,
|
post_id: data.post_id,
|
||||||
featured: data.featured,
|
featured: Some(data.featured),
|
||||||
is_featured_community: data.feature_type == PostFeatureType::Community,
|
is_featured_community: Some(data.feature_type == PostFeatureType::Community),
|
||||||
};
|
};
|
||||||
|
|
||||||
ModFeaturePost::create(&mut context.pool(), &form).await?;
|
ModFeaturePost::create(&mut context.pool(), &form).await?;
|
||||||
|
|
|
@ -7,10 +7,13 @@ use lemmy_api_common::{
|
||||||
LemmyErrorType,
|
LemmyErrorType,
|
||||||
SuccessResponse,
|
SuccessResponse,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::{
|
||||||
federation_allowlist::{FederationAllowList, FederationAllowListForm},
|
source::{
|
||||||
instance::Instance,
|
federation_allowlist::{FederationAllowList, FederationAllowListForm},
|
||||||
mod_log::admin::{AdminAllowInstance, AdminAllowInstanceForm},
|
instance::Instance,
|
||||||
|
mod_log::admin::{AdminAllowInstance, AdminAllowInstanceForm},
|
||||||
|
},
|
||||||
|
traits::Crud,
|
||||||
};
|
};
|
||||||
use lemmy_db_views::structs::LocalUserView;
|
use lemmy_db_views::structs::LocalUserView;
|
||||||
use lemmy_utils::error::LemmyResult;
|
use lemmy_utils::error::LemmyResult;
|
||||||
|
@ -47,7 +50,7 @@ pub async fn admin_allow_instance(
|
||||||
reason: data.reason.clone(),
|
reason: data.reason.clone(),
|
||||||
allowed: data.allow,
|
allowed: data.allow,
|
||||||
};
|
};
|
||||||
AdminAllowInstance::insert(&mut context.pool(), &mod_log_form).await?;
|
AdminAllowInstance::create(&mut context.pool(), &mod_log_form).await?;
|
||||||
|
|
||||||
Ok(Json(SuccessResponse::default()))
|
Ok(Json(SuccessResponse::default()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,13 @@ use lemmy_api_common::{
|
||||||
LemmyErrorType,
|
LemmyErrorType,
|
||||||
SuccessResponse,
|
SuccessResponse,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::{
|
||||||
federation_blocklist::{FederationBlockList, FederationBlockListForm},
|
source::{
|
||||||
instance::Instance,
|
federation_blocklist::{FederationBlockList, FederationBlockListForm},
|
||||||
mod_log::admin::{AdminBlockInstance, AdminBlockInstanceForm},
|
instance::Instance,
|
||||||
|
mod_log::admin::{AdminBlockInstance, AdminBlockInstanceForm},
|
||||||
|
},
|
||||||
|
traits::Crud,
|
||||||
};
|
};
|
||||||
use lemmy_db_views::structs::LocalUserView;
|
use lemmy_db_views::structs::LocalUserView;
|
||||||
use lemmy_utils::error::LemmyResult;
|
use lemmy_utils::error::LemmyResult;
|
||||||
|
@ -48,9 +51,8 @@ pub async fn admin_block_instance(
|
||||||
admin_person_id: local_user_view.person.id,
|
admin_person_id: local_user_view.person.id,
|
||||||
blocked: data.block,
|
blocked: data.block,
|
||||||
reason: data.reason.clone(),
|
reason: data.reason.clone(),
|
||||||
when_: data.expires,
|
|
||||||
};
|
};
|
||||||
AdminBlockInstance::insert(&mut context.pool(), &mod_log_form).await?;
|
AdminBlockInstance::create(&mut context.pool(), &mod_log_form).await?;
|
||||||
|
|
||||||
Ok(Json(SuccessResponse::default()))
|
Ok(Json(SuccessResponse::default()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,30 +4,10 @@ use lemmy_api_common::{
|
||||||
site::{GetModlog, GetModlogResponse},
|
site::{GetModlog, GetModlogResponse},
|
||||||
utils::{check_community_mod_of_any_or_admin_action, check_private_instance},
|
utils::{check_community_mod_of_any_or_admin_action, check_private_instance},
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{source::local_site::LocalSite, ModlogActionType};
|
use lemmy_db_schema::source::local_site::LocalSite;
|
||||||
use lemmy_db_views::structs::LocalUserView;
|
use lemmy_db_views::structs::LocalUserView;
|
||||||
use lemmy_db_views_moderator::structs::{
|
use lemmy_db_views_moderator::{self, modlog_combined_view::ModlogCombinedQuery};
|
||||||
AdminAllowInstanceView,
|
|
||||||
AdminBlockInstanceView,
|
|
||||||
AdminPurgeCommentView,
|
|
||||||
AdminPurgeCommunityView,
|
|
||||||
AdminPurgePersonView,
|
|
||||||
AdminPurgePostView,
|
|
||||||
ModAddCommunityView,
|
|
||||||
ModAddView,
|
|
||||||
ModBanFromCommunityView,
|
|
||||||
ModBanView,
|
|
||||||
ModFeaturePostView,
|
|
||||||
ModHideCommunityView,
|
|
||||||
ModLockPostView,
|
|
||||||
ModRemoveCommentView,
|
|
||||||
ModRemoveCommunityView,
|
|
||||||
ModRemovePostView,
|
|
||||||
ModTransferCommunityView,
|
|
||||||
ModlogListParams,
|
|
||||||
};
|
|
||||||
use lemmy_utils::error::LemmyResult;
|
use lemmy_utils::error::LemmyResult;
|
||||||
use ModlogActionType::*;
|
|
||||||
|
|
||||||
#[tracing::instrument(skip(context))]
|
#[tracing::instrument(skip(context))]
|
||||||
pub async fn get_mod_log(
|
pub async fn get_mod_log(
|
||||||
|
@ -39,7 +19,7 @@ pub async fn get_mod_log(
|
||||||
|
|
||||||
check_private_instance(&local_user_view, &local_site)?;
|
check_private_instance(&local_user_view, &local_site)?;
|
||||||
|
|
||||||
let type_ = data.type_.unwrap_or(All);
|
let type_ = data.type_;
|
||||||
let community_id = data.community_id;
|
let community_id = data.community_id;
|
||||||
|
|
||||||
let is_mod_or_admin = if let Some(local_user_view) = local_user_view {
|
let is_mod_or_admin = if let Some(local_user_view) = local_user_view {
|
||||||
|
@ -60,146 +40,27 @@ pub async fn get_mod_log(
|
||||||
let post_id = data.post_id;
|
let post_id = data.post_id;
|
||||||
let comment_id = data.comment_id;
|
let comment_id = data.comment_id;
|
||||||
|
|
||||||
let params = ModlogListParams {
|
// parse pagination token
|
||||||
|
let page_after = if let Some(pa) = &data.page_cursor {
|
||||||
|
Some(pa.read(&mut context.pool()).await?)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
let page_back = data.page_back;
|
||||||
|
|
||||||
|
let modlog = ModlogCombinedQuery {
|
||||||
|
type_,
|
||||||
community_id,
|
community_id,
|
||||||
mod_person_id,
|
mod_person_id,
|
||||||
other_person_id,
|
other_person_id,
|
||||||
post_id,
|
post_id,
|
||||||
comment_id,
|
comment_id,
|
||||||
page: data.page,
|
hide_modlog_names: Some(hide_modlog_names),
|
||||||
limit: data.limit,
|
page_after,
|
||||||
hide_modlog_names,
|
page_back,
|
||||||
};
|
}
|
||||||
let removed_posts = match type_ {
|
.list(&mut context.pool())
|
||||||
All | ModRemovePost => ModRemovePostView::list(&mut context.pool(), params).await?,
|
.await?;
|
||||||
_ => Default::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let locked_posts = match type_ {
|
Ok(Json(GetModlogResponse { modlog }))
|
||||||
All | ModLockPost => ModLockPostView::list(&mut context.pool(), params).await?,
|
|
||||||
_ => Default::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let featured_posts = match type_ {
|
|
||||||
All | ModFeaturePost => ModFeaturePostView::list(&mut context.pool(), params).await?,
|
|
||||||
_ => Default::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let removed_comments = match type_ {
|
|
||||||
All | ModRemoveComment => ModRemoveCommentView::list(&mut context.pool(), params).await?,
|
|
||||||
_ => Default::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let banned_from_community = match type_ {
|
|
||||||
All | ModBanFromCommunity => ModBanFromCommunityView::list(&mut context.pool(), params).await?,
|
|
||||||
_ => Default::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let added_to_community = match type_ {
|
|
||||||
All | ModAddCommunity => ModAddCommunityView::list(&mut context.pool(), params).await?,
|
|
||||||
_ => Default::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let transferred_to_community = match type_ {
|
|
||||||
All | ModTransferCommunity => {
|
|
||||||
ModTransferCommunityView::list(&mut context.pool(), params).await?
|
|
||||||
}
|
|
||||||
_ => Default::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let hidden_communities = match type_ {
|
|
||||||
All | ModHideCommunity if other_person_id.is_none() => {
|
|
||||||
ModHideCommunityView::list(&mut context.pool(), params).await?
|
|
||||||
}
|
|
||||||
_ => Default::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
// These arrays are only for the full modlog, when a community isn't given
|
|
||||||
let (
|
|
||||||
banned,
|
|
||||||
added,
|
|
||||||
removed_communities,
|
|
||||||
admin_purged_persons,
|
|
||||||
admin_purged_communities,
|
|
||||||
admin_purged_posts,
|
|
||||||
admin_purged_comments,
|
|
||||||
admin_block_instance,
|
|
||||||
admin_allow_instance,
|
|
||||||
) = if data.community_id.is_none() {
|
|
||||||
(
|
|
||||||
match type_ {
|
|
||||||
All | ModBan => ModBanView::list(&mut context.pool(), params).await?,
|
|
||||||
_ => Default::default(),
|
|
||||||
},
|
|
||||||
match type_ {
|
|
||||||
All | ModAdd => ModAddView::list(&mut context.pool(), params).await?,
|
|
||||||
_ => Default::default(),
|
|
||||||
},
|
|
||||||
match type_ {
|
|
||||||
All | ModRemoveCommunity if other_person_id.is_none() => {
|
|
||||||
ModRemoveCommunityView::list(&mut context.pool(), params).await?
|
|
||||||
}
|
|
||||||
_ => Default::default(),
|
|
||||||
},
|
|
||||||
match type_ {
|
|
||||||
All | AdminPurgePerson if other_person_id.is_none() => {
|
|
||||||
AdminPurgePersonView::list(&mut context.pool(), params).await?
|
|
||||||
}
|
|
||||||
_ => Default::default(),
|
|
||||||
},
|
|
||||||
match type_ {
|
|
||||||
All | AdminPurgeCommunity if other_person_id.is_none() => {
|
|
||||||
AdminPurgeCommunityView::list(&mut context.pool(), params).await?
|
|
||||||
}
|
|
||||||
_ => Default::default(),
|
|
||||||
},
|
|
||||||
match type_ {
|
|
||||||
All | AdminPurgePost if other_person_id.is_none() => {
|
|
||||||
AdminPurgePostView::list(&mut context.pool(), params).await?
|
|
||||||
}
|
|
||||||
_ => Default::default(),
|
|
||||||
},
|
|
||||||
match type_ {
|
|
||||||
All | AdminPurgeComment if other_person_id.is_none() => {
|
|
||||||
AdminPurgeCommentView::list(&mut context.pool(), params).await?
|
|
||||||
}
|
|
||||||
_ => Default::default(),
|
|
||||||
},
|
|
||||||
match type_ {
|
|
||||||
All | AdminBlockInstance if other_person_id.is_none() => {
|
|
||||||
AdminBlockInstanceView::list(&mut context.pool(), params).await?
|
|
||||||
}
|
|
||||||
_ => Default::default(),
|
|
||||||
},
|
|
||||||
match type_ {
|
|
||||||
All | AdminAllowInstance if other_person_id.is_none() => {
|
|
||||||
AdminAllowInstanceView::list(&mut context.pool(), params).await?
|
|
||||||
}
|
|
||||||
_ => Default::default(),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
// Return the jwt
|
|
||||||
Ok(Json(GetModlogResponse {
|
|
||||||
removed_posts,
|
|
||||||
locked_posts,
|
|
||||||
featured_posts,
|
|
||||||
removed_comments,
|
|
||||||
removed_communities,
|
|
||||||
banned_from_community,
|
|
||||||
banned,
|
|
||||||
added_to_community,
|
|
||||||
added,
|
|
||||||
transferred_to_community,
|
|
||||||
admin_purged_persons,
|
|
||||||
admin_purged_communities,
|
|
||||||
admin_purged_posts,
|
|
||||||
admin_purged_comments,
|
|
||||||
hidden_communities,
|
|
||||||
admin_block_instance,
|
|
||||||
admin_allow_instance,
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,25 +42,7 @@ use lemmy_db_views_actor::structs::{
|
||||||
CommunityView,
|
CommunityView,
|
||||||
PersonView,
|
PersonView,
|
||||||
};
|
};
|
||||||
use lemmy_db_views_moderator::structs::{
|
use lemmy_db_views_moderator::structs::{ModlogCombinedPaginationCursor, ModlogCombinedView};
|
||||||
AdminAllowInstanceView,
|
|
||||||
AdminBlockInstanceView,
|
|
||||||
AdminPurgeCommentView,
|
|
||||||
AdminPurgeCommunityView,
|
|
||||||
AdminPurgePersonView,
|
|
||||||
AdminPurgePostView,
|
|
||||||
ModAddCommunityView,
|
|
||||||
ModAddView,
|
|
||||||
ModBanFromCommunityView,
|
|
||||||
ModBanView,
|
|
||||||
ModFeaturePostView,
|
|
||||||
ModHideCommunityView,
|
|
||||||
ModLockPostView,
|
|
||||||
ModRemoveCommentView,
|
|
||||||
ModRemoveCommunityView,
|
|
||||||
ModRemovePostView,
|
|
||||||
ModTransferCommunityView,
|
|
||||||
};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
|
@ -139,7 +121,7 @@ pub struct ResolveObjectResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Fetches the modlog.
|
/// Fetches the modlog.
|
||||||
|
@ -149,10 +131,6 @@ pub struct GetModlog {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<ModlogActionType>,
|
pub type_: Option<ModlogActionType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub other_person_id: Option<PersonId>,
|
pub other_person_id: Option<PersonId>,
|
||||||
|
@ -160,31 +138,18 @@ pub struct GetModlog {
|
||||||
pub post_id: Option<PostId>,
|
pub post_id: Option<PostId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment_id: Option<CommentId>,
|
pub comment_id: Option<CommentId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
|
pub page_cursor: Option<ModlogCombinedPaginationCursor>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
|
pub page_back: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// The modlog fetch response.
|
/// The modlog fetch response.
|
||||||
// TODO this should be redone as a list of tagged enums
|
|
||||||
pub struct GetModlogResponse {
|
pub struct GetModlogResponse {
|
||||||
pub removed_posts: Vec<ModRemovePostView>,
|
pub modlog: Vec<ModlogCombinedView>,
|
||||||
pub locked_posts: Vec<ModLockPostView>,
|
|
||||||
pub featured_posts: Vec<ModFeaturePostView>,
|
|
||||||
pub removed_comments: Vec<ModRemoveCommentView>,
|
|
||||||
pub removed_communities: Vec<ModRemoveCommunityView>,
|
|
||||||
pub banned_from_community: Vec<ModBanFromCommunityView>,
|
|
||||||
pub banned: Vec<ModBanView>,
|
|
||||||
pub added_to_community: Vec<ModAddCommunityView>,
|
|
||||||
pub transferred_to_community: Vec<ModTransferCommunityView>,
|
|
||||||
pub added: Vec<ModAddView>,
|
|
||||||
pub admin_purged_persons: Vec<AdminPurgePersonView>,
|
|
||||||
pub admin_purged_communities: Vec<AdminPurgeCommunityView>,
|
|
||||||
pub admin_purged_posts: Vec<AdminPurgePostView>,
|
|
||||||
pub admin_purged_comments: Vec<AdminPurgeCommentView>,
|
|
||||||
pub hidden_communities: Vec<ModHideCommunityView>,
|
|
||||||
pub admin_block_instance: Vec<AdminBlockInstanceView>,
|
|
||||||
pub admin_allow_instance: Vec<AdminAllowInstanceView>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
|
|
|
@ -1157,16 +1157,18 @@ fn build_proxied_image_url(
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::{
|
||||||
comment::CommentInsertForm,
|
source::{
|
||||||
community::CommunityInsertForm,
|
comment::CommentInsertForm,
|
||||||
person::PersonInsertForm,
|
community::CommunityInsertForm,
|
||||||
post::PostInsertForm,
|
person::PersonInsertForm,
|
||||||
|
post::PostInsertForm,
|
||||||
|
},
|
||||||
|
ModlogActionType,
|
||||||
};
|
};
|
||||||
use lemmy_db_views_moderator::structs::{
|
use lemmy_db_views_moderator::{
|
||||||
ModRemoveCommentView,
|
modlog_combined_view::ModlogCombinedQuery,
|
||||||
ModRemovePostView,
|
structs::{ModRemoveCommentView, ModRemovePostView, ModlogCombinedView},
|
||||||
ModlogListParams,
|
|
||||||
};
|
};
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
|
@ -1302,48 +1304,55 @@ mod tests {
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Verify that their posts and comments are removed.
|
// Verify that their posts and comments are removed.
|
||||||
let params = ModlogListParams {
|
|
||||||
community_id: None,
|
|
||||||
mod_person_id: None,
|
|
||||||
other_person_id: None,
|
|
||||||
post_id: None,
|
|
||||||
comment_id: None,
|
|
||||||
page: None,
|
|
||||||
limit: None,
|
|
||||||
hide_modlog_names: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Posts
|
// Posts
|
||||||
let post_modlog = ModRemovePostView::list(pool, params).await?;
|
let post_modlog = ModlogCombinedQuery {
|
||||||
|
type_: Some(ModlogActionType::ModRemovePost),
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
.list(pool)
|
||||||
|
.await?;
|
||||||
assert_eq!(2, post_modlog.len());
|
assert_eq!(2, post_modlog.len());
|
||||||
|
|
||||||
let mod_removed_posts = post_modlog
|
assert!(matches!(
|
||||||
.iter()
|
&post_modlog[..],
|
||||||
.map(|p| p.mod_remove_post.removed)
|
[
|
||||||
.collect::<Vec<bool>>();
|
ModlogCombinedView::ModRemovePost(ModRemovePostView {
|
||||||
assert_eq!(vec![true, true], mod_removed_posts);
|
mod_remove_post: ModRemovePost { removed: true, .. },
|
||||||
|
post: Post { removed: true, .. },
|
||||||
let removed_posts = post_modlog
|
..
|
||||||
.iter()
|
}),
|
||||||
.map(|p| p.post.removed)
|
ModlogCombinedView::ModRemovePost(ModRemovePostView {
|
||||||
.collect::<Vec<bool>>();
|
mod_remove_post: ModRemovePost { removed: true, .. },
|
||||||
assert_eq!(vec![true, true], removed_posts);
|
post: Post { removed: true, .. },
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
let comment_modlog = ModRemoveCommentView::list(pool, params).await?;
|
let comment_modlog = ModlogCombinedQuery {
|
||||||
|
type_: Some(ModlogActionType::ModRemoveComment),
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
.list(pool)
|
||||||
|
.await?;
|
||||||
assert_eq!(2, comment_modlog.len());
|
assert_eq!(2, comment_modlog.len());
|
||||||
|
|
||||||
let mod_removed_comments = comment_modlog
|
assert!(matches!(
|
||||||
.iter()
|
&comment_modlog[..],
|
||||||
.map(|p| p.mod_remove_comment.removed)
|
[
|
||||||
.collect::<Vec<bool>>();
|
ModlogCombinedView::ModRemoveComment(ModRemoveCommentView {
|
||||||
assert_eq!(vec![true, true], mod_removed_comments);
|
mod_remove_comment: ModRemoveComment { removed: true, .. },
|
||||||
|
comment: Comment { removed: true, .. },
|
||||||
let removed_comments = comment_modlog
|
..
|
||||||
.iter()
|
}),
|
||||||
.map(|p| p.comment.removed)
|
ModlogCombinedView::ModRemoveComment(ModRemoveCommentView {
|
||||||
.collect::<Vec<bool>>();
|
mod_remove_comment: ModRemoveComment { removed: true, .. },
|
||||||
assert_eq!(vec![true, true], removed_comments);
|
comment: Comment { removed: true, .. },
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
|
||||||
// Now restore the content, and make sure it got appended
|
// Now restore the content, and make sure it got appended
|
||||||
remove_or_restore_user_data(
|
remove_or_restore_user_data(
|
||||||
|
@ -1356,37 +1365,74 @@ mod tests {
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Posts
|
// Posts
|
||||||
let post_modlog = ModRemovePostView::list(pool, params).await?;
|
let post_modlog = ModlogCombinedQuery {
|
||||||
|
type_: Some(ModlogActionType::ModRemovePost),
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
.list(pool)
|
||||||
|
.await?;
|
||||||
assert_eq!(4, post_modlog.len());
|
assert_eq!(4, post_modlog.len());
|
||||||
|
|
||||||
let mod_restored_posts = post_modlog
|
assert!(matches!(
|
||||||
.iter()
|
&post_modlog[..],
|
||||||
.map(|p| p.mod_remove_post.removed)
|
[
|
||||||
.collect::<Vec<bool>>();
|
ModlogCombinedView::ModRemovePost(ModRemovePostView {
|
||||||
assert_eq!(vec![false, false, true, true], mod_restored_posts);
|
mod_remove_post: ModRemovePost { removed: false, .. },
|
||||||
|
post: Post { removed: false, .. },
|
||||||
let restored_posts = post_modlog
|
..
|
||||||
.iter()
|
}),
|
||||||
.map(|p| p.post.removed)
|
ModlogCombinedView::ModRemovePost(ModRemovePostView {
|
||||||
.collect::<Vec<bool>>();
|
mod_remove_post: ModRemovePost { removed: false, .. },
|
||||||
// All of these will be false, cause its the current state of the post
|
post: Post { removed: false, .. },
|
||||||
assert_eq!(vec![false, false, false, false], restored_posts);
|
..
|
||||||
|
}),
|
||||||
|
ModlogCombinedView::ModRemovePost(ModRemovePostView {
|
||||||
|
mod_remove_post: ModRemovePost { removed: true, .. },
|
||||||
|
post: Post { removed: false, .. },
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
ModlogCombinedView::ModRemovePost(ModRemovePostView {
|
||||||
|
mod_remove_post: ModRemovePost { removed: true, .. },
|
||||||
|
post: Post { removed: false, .. },
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
let comment_modlog = ModRemoveCommentView::list(pool, params).await?;
|
let comment_modlog = ModlogCombinedQuery {
|
||||||
|
type_: Some(ModlogActionType::ModRemoveComment),
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
.list(pool)
|
||||||
|
.await?;
|
||||||
assert_eq!(4, comment_modlog.len());
|
assert_eq!(4, comment_modlog.len());
|
||||||
|
|
||||||
let mod_restored_comments = comment_modlog
|
assert!(matches!(
|
||||||
.iter()
|
&comment_modlog[..],
|
||||||
.map(|p| p.mod_remove_comment.removed)
|
[
|
||||||
.collect::<Vec<bool>>();
|
ModlogCombinedView::ModRemoveComment(ModRemoveCommentView {
|
||||||
assert_eq!(vec![false, false, true, true], mod_restored_comments);
|
mod_remove_comment: ModRemoveComment { removed: false, .. },
|
||||||
|
comment: Comment { removed: false, .. },
|
||||||
let restored_comments = comment_modlog
|
..
|
||||||
.iter()
|
}),
|
||||||
.map(|p| p.comment.removed)
|
ModlogCombinedView::ModRemoveComment(ModRemoveCommentView {
|
||||||
.collect::<Vec<bool>>();
|
mod_remove_comment: ModRemoveComment { removed: false, .. },
|
||||||
assert_eq!(vec![false, false, false, false], restored_comments);
|
comment: Comment { removed: false, .. },
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
ModlogCombinedView::ModRemoveComment(ModRemoveCommentView {
|
||||||
|
mod_remove_comment: ModRemoveComment { removed: true, .. },
|
||||||
|
comment: Comment { removed: false, .. },
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
ModlogCombinedView::ModRemoveComment(ModRemoveCommentView {
|
||||||
|
mod_remove_comment: ModRemoveComment { removed: true, .. },
|
||||||
|
comment: Comment { removed: false, .. },
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
|
||||||
Instance::delete(pool, inserted_instance.id).await?;
|
Instance::delete(pool, inserted_instance.id).await?;
|
||||||
|
|
||||||
|
|
|
@ -782,3 +782,78 @@ CALL r.create_person_saved_combined_trigger ('post');
|
||||||
|
|
||||||
CALL r.create_person_saved_combined_trigger ('comment');
|
CALL r.create_person_saved_combined_trigger ('comment');
|
||||||
|
|
||||||
|
-- modlog: (17 tables)
|
||||||
|
-- admin_allow_instance
|
||||||
|
-- admin_block_instance
|
||||||
|
-- admin_purge_comment
|
||||||
|
-- admin_purge_community
|
||||||
|
-- admin_purge_person
|
||||||
|
-- admin_purge_post
|
||||||
|
-- mod_add
|
||||||
|
-- mod_add_community
|
||||||
|
-- mod_ban
|
||||||
|
-- mod_ban_from_community
|
||||||
|
-- mod_feature_post
|
||||||
|
-- mod_hide_community
|
||||||
|
-- mod_lock_post
|
||||||
|
-- mod_remove_comment
|
||||||
|
-- mod_remove_community
|
||||||
|
-- mod_remove_post
|
||||||
|
-- mod_transfer_community
|
||||||
|
CREATE PROCEDURE r.create_modlog_combined_trigger (table_name text)
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $a$
|
||||||
|
BEGIN
|
||||||
|
EXECUTE replace($b$ CREATE FUNCTION r.modlog_combined_thing_insert ( )
|
||||||
|
RETURNS TRIGGER
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO modlog_combined (published, thing_id)
|
||||||
|
VALUES (NEW.published, NEW.id);
|
||||||
|
RETURN NEW;
|
||||||
|
END $$;
|
||||||
|
CREATE TRIGGER modlog_combined
|
||||||
|
AFTER INSERT ON thing
|
||||||
|
FOR EACH ROW
|
||||||
|
EXECUTE FUNCTION r.modlog_combined_thing_insert ( );
|
||||||
|
$b$,
|
||||||
|
'thing',
|
||||||
|
table_name);
|
||||||
|
END;
|
||||||
|
$a$;
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('admin_allow_instance');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('admin_block_instance');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('admin_purge_comment');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('admin_purge_community');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('admin_purge_person');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('admin_purge_post');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_add');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_add_community');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_ban');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_ban_from_community');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_feature_post');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_hide_community');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_lock_post');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_remove_comment');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_remove_community');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_remove_post');
|
||||||
|
|
||||||
|
CALL r.create_modlog_combined_trigger ('mod_transfer_community');
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,25 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
newtypes::InstanceId,
|
newtypes::InstanceId,
|
||||||
schema::{admin_allow_instance, federation_allowlist},
|
schema::federation_allowlist,
|
||||||
source::{
|
source::federation_allowlist::{FederationAllowList, FederationAllowListForm},
|
||||||
federation_allowlist::{FederationAllowList, FederationAllowListForm},
|
|
||||||
mod_log::admin::{AdminAllowInstance, AdminAllowInstanceForm},
|
|
||||||
},
|
|
||||||
utils::{get_conn, DbPool},
|
utils::{get_conn, DbPool},
|
||||||
};
|
};
|
||||||
use diesel::{delete, dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
use diesel::{delete, dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||||
use diesel_async::RunQueryDsl;
|
use diesel_async::RunQueryDsl;
|
||||||
|
|
||||||
impl AdminAllowInstance {
|
|
||||||
pub async fn insert(pool: &mut DbPool<'_>, form: &AdminAllowInstanceForm) -> Result<(), Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
insert_into(admin_allow_instance::table)
|
|
||||||
.values(form)
|
|
||||||
.execute(conn)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FederationAllowList {
|
impl FederationAllowList {
|
||||||
pub async fn allow(pool: &mut DbPool<'_>, form: &FederationAllowListForm) -> Result<(), Error> {
|
pub async fn allow(pool: &mut DbPool<'_>, form: &FederationAllowListForm) -> Result<Self, Error> {
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(federation_allowlist::table)
|
insert_into(federation_allowlist::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.execute(conn)
|
.get_result::<Self>(conn)
|
||||||
.await?;
|
.await
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
pub async fn unallow(pool: &mut DbPool<'_>, instance_id_: InstanceId) -> Result<(), Error> {
|
pub async fn unallow(pool: &mut DbPool<'_>, instance_id_: InstanceId) -> Result<usize, Error> {
|
||||||
use federation_allowlist::dsl::instance_id;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
delete(federation_allowlist::table.filter(instance_id.eq(instance_id_)))
|
delete(federation_allowlist::table.filter(federation_allowlist::instance_id.eq(instance_id_)))
|
||||||
.execute(conn)
|
.execute(conn)
|
||||||
.await?;
|
.await
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,24 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
newtypes::InstanceId,
|
newtypes::InstanceId,
|
||||||
schema::{admin_block_instance, federation_blocklist},
|
schema::federation_blocklist,
|
||||||
source::{
|
source::federation_blocklist::{FederationBlockList, FederationBlockListForm},
|
||||||
federation_blocklist::{FederationBlockList, FederationBlockListForm},
|
|
||||||
mod_log::admin::{AdminBlockInstance, AdminBlockInstanceForm},
|
|
||||||
},
|
|
||||||
utils::{get_conn, DbPool},
|
utils::{get_conn, DbPool},
|
||||||
};
|
};
|
||||||
use diesel::{delete, dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
use diesel::{delete, dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||||
use diesel_async::RunQueryDsl;
|
use diesel_async::RunQueryDsl;
|
||||||
|
|
||||||
impl AdminBlockInstance {
|
|
||||||
pub async fn insert(pool: &mut DbPool<'_>, form: &AdminBlockInstanceForm) -> Result<(), Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
insert_into(admin_block_instance::table)
|
|
||||||
.values(form)
|
|
||||||
.execute(conn)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FederationBlockList {
|
impl FederationBlockList {
|
||||||
pub async fn block(pool: &mut DbPool<'_>, form: &FederationBlockListForm) -> Result<(), Error> {
|
pub async fn block(pool: &mut DbPool<'_>, form: &FederationBlockListForm) -> Result<Self, Error> {
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(federation_blocklist::table)
|
insert_into(federation_blocklist::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.execute(conn)
|
.get_result::<Self>(conn)
|
||||||
.await?;
|
.await
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
pub async fn unblock(pool: &mut DbPool<'_>, instance_id_: InstanceId) -> Result<(), Error> {
|
pub async fn unblock(pool: &mut DbPool<'_>, instance_id_: InstanceId) -> Result<usize, Error> {
|
||||||
use federation_blocklist::dsl::instance_id;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
delete(federation_blocklist::table.filter(instance_id.eq(instance_id_)))
|
delete(federation_blocklist::table.filter(federation_blocklist::instance_id.eq(instance_id_)))
|
||||||
.execute(conn)
|
.execute(conn)
|
||||||
.await?;
|
.await
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
|
newtypes::{
|
||||||
|
AdminAllowInstanceId,
|
||||||
|
AdminBlockInstanceId,
|
||||||
|
AdminPurgeCommentId,
|
||||||
|
AdminPurgeCommunityId,
|
||||||
|
AdminPurgePersonId,
|
||||||
|
AdminPurgePostId,
|
||||||
|
},
|
||||||
|
schema::{
|
||||||
|
admin_allow_instance,
|
||||||
|
admin_block_instance,
|
||||||
|
admin_purge_comment,
|
||||||
|
admin_purge_community,
|
||||||
|
admin_purge_person,
|
||||||
|
admin_purge_post,
|
||||||
|
},
|
||||||
source::mod_log::admin::{
|
source::mod_log::admin::{
|
||||||
|
AdminAllowInstance,
|
||||||
|
AdminAllowInstanceForm,
|
||||||
|
AdminBlockInstance,
|
||||||
|
AdminBlockInstanceForm,
|
||||||
AdminPurgeComment,
|
AdminPurgeComment,
|
||||||
AdminPurgeCommentForm,
|
AdminPurgeCommentForm,
|
||||||
AdminPurgeCommunity,
|
AdminPurgeCommunity,
|
||||||
|
@ -19,12 +39,11 @@ use diesel_async::RunQueryDsl;
|
||||||
impl Crud for AdminPurgePerson {
|
impl Crud for AdminPurgePerson {
|
||||||
type InsertForm = AdminPurgePersonForm;
|
type InsertForm = AdminPurgePersonForm;
|
||||||
type UpdateForm = AdminPurgePersonForm;
|
type UpdateForm = AdminPurgePersonForm;
|
||||||
type IdType = i32;
|
type IdType = AdminPurgePersonId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::admin_purge_person::dsl::admin_purge_person;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(admin_purge_person)
|
insert_into(admin_purge_person::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -32,12 +51,11 @@ impl Crud for AdminPurgePerson {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &Self::InsertForm,
|
form: &Self::InsertForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::admin_purge_person::dsl::admin_purge_person;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(admin_purge_person.find(from_id))
|
diesel::update(admin_purge_person::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -48,12 +66,11 @@ impl Crud for AdminPurgePerson {
|
||||||
impl Crud for AdminPurgeCommunity {
|
impl Crud for AdminPurgeCommunity {
|
||||||
type InsertForm = AdminPurgeCommunityForm;
|
type InsertForm = AdminPurgeCommunityForm;
|
||||||
type UpdateForm = AdminPurgeCommunityForm;
|
type UpdateForm = AdminPurgeCommunityForm;
|
||||||
type IdType = i32;
|
type IdType = AdminPurgeCommunityId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::admin_purge_community::dsl::admin_purge_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(admin_purge_community)
|
insert_into(admin_purge_community::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -61,12 +78,11 @@ impl Crud for AdminPurgeCommunity {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &Self::InsertForm,
|
form: &Self::InsertForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::admin_purge_community::dsl::admin_purge_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(admin_purge_community.find(from_id))
|
diesel::update(admin_purge_community::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -77,12 +93,11 @@ impl Crud for AdminPurgeCommunity {
|
||||||
impl Crud for AdminPurgePost {
|
impl Crud for AdminPurgePost {
|
||||||
type InsertForm = AdminPurgePostForm;
|
type InsertForm = AdminPurgePostForm;
|
||||||
type UpdateForm = AdminPurgePostForm;
|
type UpdateForm = AdminPurgePostForm;
|
||||||
type IdType = i32;
|
type IdType = AdminPurgePostId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::admin_purge_post::dsl::admin_purge_post;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(admin_purge_post)
|
insert_into(admin_purge_post::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -90,12 +105,11 @@ impl Crud for AdminPurgePost {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &Self::InsertForm,
|
form: &Self::InsertForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::admin_purge_post::dsl::admin_purge_post;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(admin_purge_post.find(from_id))
|
diesel::update(admin_purge_post::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -106,12 +120,11 @@ impl Crud for AdminPurgePost {
|
||||||
impl Crud for AdminPurgeComment {
|
impl Crud for AdminPurgeComment {
|
||||||
type InsertForm = AdminPurgeCommentForm;
|
type InsertForm = AdminPurgeCommentForm;
|
||||||
type UpdateForm = AdminPurgeCommentForm;
|
type UpdateForm = AdminPurgeCommentForm;
|
||||||
type IdType = i32;
|
type IdType = AdminPurgeCommentId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(admin_purge_comment)
|
insert_into(admin_purge_comment::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -119,12 +132,65 @@ impl Crud for AdminPurgeComment {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &Self::InsertForm,
|
form: &Self::InsertForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(admin_purge_comment.find(from_id))
|
diesel::update(admin_purge_comment::table.find(from_id))
|
||||||
|
.set(form)
|
||||||
|
.get_result::<Self>(conn)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl Crud for AdminAllowInstance {
|
||||||
|
type InsertForm = AdminAllowInstanceForm;
|
||||||
|
type UpdateForm = AdminAllowInstanceForm;
|
||||||
|
type IdType = AdminAllowInstanceId;
|
||||||
|
|
||||||
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
|
let conn = &mut get_conn(pool).await?;
|
||||||
|
insert_into(admin_allow_instance::table)
|
||||||
|
.values(form)
|
||||||
|
.get_result::<Self>(conn)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn update(
|
||||||
|
pool: &mut DbPool<'_>,
|
||||||
|
from_id: Self::IdType,
|
||||||
|
form: &Self::InsertForm,
|
||||||
|
) -> Result<Self, Error> {
|
||||||
|
let conn = &mut get_conn(pool).await?;
|
||||||
|
diesel::update(admin_allow_instance::table.find(from_id))
|
||||||
|
.set(form)
|
||||||
|
.get_result::<Self>(conn)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl Crud for AdminBlockInstance {
|
||||||
|
type InsertForm = AdminBlockInstanceForm;
|
||||||
|
type UpdateForm = AdminBlockInstanceForm;
|
||||||
|
type IdType = AdminBlockInstanceId;
|
||||||
|
|
||||||
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
|
let conn = &mut get_conn(pool).await?;
|
||||||
|
insert_into(admin_block_instance::table)
|
||||||
|
.values(form)
|
||||||
|
.get_result::<Self>(conn)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn update(
|
||||||
|
pool: &mut DbPool<'_>,
|
||||||
|
from_id: Self::IdType,
|
||||||
|
form: &Self::InsertForm,
|
||||||
|
) -> Result<Self, Error> {
|
||||||
|
let conn = &mut get_conn(pool).await?;
|
||||||
|
diesel::update(admin_block_instance::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -1,4 +1,30 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
|
newtypes::{
|
||||||
|
ModAddCommunityId,
|
||||||
|
ModAddId,
|
||||||
|
ModBanFromCommunityId,
|
||||||
|
ModBanId,
|
||||||
|
ModFeaturePostId,
|
||||||
|
ModHideCommunityId,
|
||||||
|
ModLockPostId,
|
||||||
|
ModRemoveCommentId,
|
||||||
|
ModRemoveCommunityId,
|
||||||
|
ModRemovePostId,
|
||||||
|
ModTransferCommunityId,
|
||||||
|
},
|
||||||
|
schema::{
|
||||||
|
mod_add,
|
||||||
|
mod_add_community,
|
||||||
|
mod_ban,
|
||||||
|
mod_ban_from_community,
|
||||||
|
mod_feature_post,
|
||||||
|
mod_hide_community,
|
||||||
|
mod_lock_post,
|
||||||
|
mod_remove_comment,
|
||||||
|
mod_remove_community,
|
||||||
|
mod_remove_post,
|
||||||
|
mod_transfer_community,
|
||||||
|
},
|
||||||
source::mod_log::moderator::{
|
source::mod_log::moderator::{
|
||||||
ModAdd,
|
ModAdd,
|
||||||
ModAddCommunity,
|
ModAddCommunity,
|
||||||
|
@ -33,12 +59,11 @@ use diesel_async::RunQueryDsl;
|
||||||
impl Crud for ModRemovePost {
|
impl Crud for ModRemovePost {
|
||||||
type InsertForm = ModRemovePostForm;
|
type InsertForm = ModRemovePostForm;
|
||||||
type UpdateForm = ModRemovePostForm;
|
type UpdateForm = ModRemovePostForm;
|
||||||
type IdType = i32;
|
type IdType = ModRemovePostId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModRemovePostForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_remove_post::dsl::mod_remove_post;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_remove_post)
|
insert_into(mod_remove_post::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -46,12 +71,11 @@ impl Crud for ModRemovePost {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &ModRemovePostForm,
|
form: &Self::UpdateForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_remove_post::dsl::mod_remove_post;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_remove_post.find(from_id))
|
diesel::update(mod_remove_post::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -63,9 +87,8 @@ impl ModRemovePost {
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
forms: &Vec<ModRemovePostForm>,
|
forms: &Vec<ModRemovePostForm>,
|
||||||
) -> Result<usize, Error> {
|
) -> Result<usize, Error> {
|
||||||
use crate::schema::mod_remove_post::dsl::mod_remove_post;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_remove_post)
|
insert_into(mod_remove_post::table)
|
||||||
.values(forms)
|
.values(forms)
|
||||||
.execute(conn)
|
.execute(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -76,12 +99,11 @@ impl ModRemovePost {
|
||||||
impl Crud for ModLockPost {
|
impl Crud for ModLockPost {
|
||||||
type InsertForm = ModLockPostForm;
|
type InsertForm = ModLockPostForm;
|
||||||
type UpdateForm = ModLockPostForm;
|
type UpdateForm = ModLockPostForm;
|
||||||
type IdType = i32;
|
type IdType = ModLockPostId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModLockPostForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_lock_post::dsl::mod_lock_post;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_lock_post)
|
insert_into(mod_lock_post::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -89,12 +111,11 @@ impl Crud for ModLockPost {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &ModLockPostForm,
|
form: &Self::UpdateForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_lock_post::dsl::mod_lock_post;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_lock_post.find(from_id))
|
diesel::update(mod_lock_post::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -105,12 +126,11 @@ impl Crud for ModLockPost {
|
||||||
impl Crud for ModFeaturePost {
|
impl Crud for ModFeaturePost {
|
||||||
type InsertForm = ModFeaturePostForm;
|
type InsertForm = ModFeaturePostForm;
|
||||||
type UpdateForm = ModFeaturePostForm;
|
type UpdateForm = ModFeaturePostForm;
|
||||||
type IdType = i32;
|
type IdType = ModFeaturePostId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModFeaturePostForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_feature_post::dsl::mod_feature_post;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_feature_post)
|
insert_into(mod_feature_post::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -118,12 +138,11 @@ impl Crud for ModFeaturePost {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &ModFeaturePostForm,
|
form: &Self::UpdateForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_feature_post::dsl::mod_feature_post;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_feature_post.find(from_id))
|
diesel::update(mod_feature_post::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -134,12 +153,11 @@ impl Crud for ModFeaturePost {
|
||||||
impl Crud for ModRemoveComment {
|
impl Crud for ModRemoveComment {
|
||||||
type InsertForm = ModRemoveCommentForm;
|
type InsertForm = ModRemoveCommentForm;
|
||||||
type UpdateForm = ModRemoveCommentForm;
|
type UpdateForm = ModRemoveCommentForm;
|
||||||
type IdType = i32;
|
type IdType = ModRemoveCommentId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModRemoveCommentForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_remove_comment::dsl::mod_remove_comment;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_remove_comment)
|
insert_into(mod_remove_comment::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -147,12 +165,11 @@ impl Crud for ModRemoveComment {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &ModRemoveCommentForm,
|
form: &Self::UpdateForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_remove_comment::dsl::mod_remove_comment;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_remove_comment.find(from_id))
|
diesel::update(mod_remove_comment::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -164,9 +181,8 @@ impl ModRemoveComment {
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
forms: &Vec<ModRemoveCommentForm>,
|
forms: &Vec<ModRemoveCommentForm>,
|
||||||
) -> Result<usize, Error> {
|
) -> Result<usize, Error> {
|
||||||
use crate::schema::mod_remove_comment::dsl::mod_remove_comment;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_remove_comment)
|
insert_into(mod_remove_comment::table)
|
||||||
.values(forms)
|
.values(forms)
|
||||||
.execute(conn)
|
.execute(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -177,12 +193,11 @@ impl ModRemoveComment {
|
||||||
impl Crud for ModRemoveCommunity {
|
impl Crud for ModRemoveCommunity {
|
||||||
type InsertForm = ModRemoveCommunityForm;
|
type InsertForm = ModRemoveCommunityForm;
|
||||||
type UpdateForm = ModRemoveCommunityForm;
|
type UpdateForm = ModRemoveCommunityForm;
|
||||||
type IdType = i32;
|
type IdType = ModRemoveCommunityId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_remove_community::dsl::mod_remove_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_remove_community)
|
insert_into(mod_remove_community::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -190,12 +205,11 @@ impl Crud for ModRemoveCommunity {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &ModRemoveCommunityForm,
|
form: &Self::UpdateForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_remove_community::dsl::mod_remove_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_remove_community.find(from_id))
|
diesel::update(mod_remove_community::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -206,12 +220,11 @@ impl Crud for ModRemoveCommunity {
|
||||||
impl Crud for ModBanFromCommunity {
|
impl Crud for ModBanFromCommunity {
|
||||||
type InsertForm = ModBanFromCommunityForm;
|
type InsertForm = ModBanFromCommunityForm;
|
||||||
type UpdateForm = ModBanFromCommunityForm;
|
type UpdateForm = ModBanFromCommunityForm;
|
||||||
type IdType = i32;
|
type IdType = ModBanFromCommunityId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_ban_from_community::dsl::mod_ban_from_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_ban_from_community)
|
insert_into(mod_ban_from_community::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -219,12 +232,11 @@ impl Crud for ModBanFromCommunity {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &ModBanFromCommunityForm,
|
form: &Self::UpdateForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_ban_from_community::dsl::mod_ban_from_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_ban_from_community.find(from_id))
|
diesel::update(mod_ban_from_community::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -235,21 +247,23 @@ impl Crud for ModBanFromCommunity {
|
||||||
impl Crud for ModBan {
|
impl Crud for ModBan {
|
||||||
type InsertForm = ModBanForm;
|
type InsertForm = ModBanForm;
|
||||||
type UpdateForm = ModBanForm;
|
type UpdateForm = ModBanForm;
|
||||||
type IdType = i32;
|
type IdType = ModBanId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModBanForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_ban::dsl::mod_ban;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_ban)
|
insert_into(mod_ban::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update(pool: &mut DbPool<'_>, from_id: i32, form: &ModBanForm) -> Result<Self, Error> {
|
async fn update(
|
||||||
use crate::schema::mod_ban::dsl::mod_ban;
|
pool: &mut DbPool<'_>,
|
||||||
|
from_id: Self::IdType,
|
||||||
|
form: &Self::UpdateForm,
|
||||||
|
) -> Result<Self, Error> {
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_ban.find(from_id))
|
diesel::update(mod_ban::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -260,12 +274,11 @@ impl Crud for ModBan {
|
||||||
impl Crud for ModHideCommunity {
|
impl Crud for ModHideCommunity {
|
||||||
type InsertForm = ModHideCommunityForm;
|
type InsertForm = ModHideCommunityForm;
|
||||||
type UpdateForm = ModHideCommunityForm;
|
type UpdateForm = ModHideCommunityForm;
|
||||||
type IdType = i32;
|
type IdType = ModHideCommunityId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModHideCommunityForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_hide_community::dsl::mod_hide_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_hide_community)
|
insert_into(mod_hide_community::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -273,12 +286,11 @@ impl Crud for ModHideCommunity {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &ModHideCommunityForm,
|
form: &Self::UpdateForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_hide_community::dsl::mod_hide_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_hide_community.find(from_id))
|
diesel::update(mod_hide_community::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -289,12 +301,11 @@ impl Crud for ModHideCommunity {
|
||||||
impl Crud for ModAddCommunity {
|
impl Crud for ModAddCommunity {
|
||||||
type InsertForm = ModAddCommunityForm;
|
type InsertForm = ModAddCommunityForm;
|
||||||
type UpdateForm = ModAddCommunityForm;
|
type UpdateForm = ModAddCommunityForm;
|
||||||
type IdType = i32;
|
type IdType = ModAddCommunityId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModAddCommunityForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_add_community::dsl::mod_add_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_add_community)
|
insert_into(mod_add_community::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -302,12 +313,11 @@ impl Crud for ModAddCommunity {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &ModAddCommunityForm,
|
form: &Self::UpdateForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_add_community::dsl::mod_add_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_add_community.find(from_id))
|
diesel::update(mod_add_community::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -318,12 +328,11 @@ impl Crud for ModAddCommunity {
|
||||||
impl Crud for ModTransferCommunity {
|
impl Crud for ModTransferCommunity {
|
||||||
type InsertForm = ModTransferCommunityForm;
|
type InsertForm = ModTransferCommunityForm;
|
||||||
type UpdateForm = ModTransferCommunityForm;
|
type UpdateForm = ModTransferCommunityForm;
|
||||||
type IdType = i32;
|
type IdType = ModTransferCommunityId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModTransferCommunityForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_transfer_community::dsl::mod_transfer_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_transfer_community)
|
insert_into(mod_transfer_community::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -331,12 +340,11 @@ impl Crud for ModTransferCommunity {
|
||||||
|
|
||||||
async fn update(
|
async fn update(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
from_id: i32,
|
from_id: Self::IdType,
|
||||||
form: &ModTransferCommunityForm,
|
form: &Self::UpdateForm,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_transfer_community::dsl::mod_transfer_community;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_transfer_community.find(from_id))
|
diesel::update(mod_transfer_community::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -347,21 +355,23 @@ impl Crud for ModTransferCommunity {
|
||||||
impl Crud for ModAdd {
|
impl Crud for ModAdd {
|
||||||
type InsertForm = ModAddForm;
|
type InsertForm = ModAddForm;
|
||||||
type UpdateForm = ModAddForm;
|
type UpdateForm = ModAddForm;
|
||||||
type IdType = i32;
|
type IdType = ModAddId;
|
||||||
|
|
||||||
async fn create(pool: &mut DbPool<'_>, form: &ModAddForm) -> Result<Self, Error> {
|
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
|
||||||
use crate::schema::mod_add::dsl::mod_add;
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
insert_into(mod_add)
|
insert_into(mod_add::table)
|
||||||
.values(form)
|
.values(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update(pool: &mut DbPool<'_>, from_id: i32, form: &ModAddForm) -> Result<Self, Error> {
|
async fn update(
|
||||||
use crate::schema::mod_add::dsl::mod_add;
|
pool: &mut DbPool<'_>,
|
||||||
|
from_id: Self::IdType,
|
||||||
|
form: &Self::UpdateForm,
|
||||||
|
) -> Result<Self, Error> {
|
||||||
let conn = &mut get_conn(pool).await?;
|
let conn = &mut get_conn(pool).await?;
|
||||||
diesel::update(mod_add.find(from_id))
|
diesel::update(mod_add::table.find(from_id))
|
||||||
.set(form)
|
.set(form)
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
.await
|
.await
|
||||||
|
@ -441,7 +451,7 @@ mod tests {
|
||||||
mod_person_id: inserted_mod.id,
|
mod_person_id: inserted_mod.id,
|
||||||
reason: None,
|
reason: None,
|
||||||
removed: true,
|
removed: true,
|
||||||
when_: inserted_mod_remove_post.when_,
|
published: inserted_mod_remove_post.published,
|
||||||
};
|
};
|
||||||
|
|
||||||
// lock post
|
// lock post
|
||||||
|
@ -458,7 +468,7 @@ mod tests {
|
||||||
post_id: inserted_post.id,
|
post_id: inserted_post.id,
|
||||||
mod_person_id: inserted_mod.id,
|
mod_person_id: inserted_mod.id,
|
||||||
locked: true,
|
locked: true,
|
||||||
when_: inserted_mod_lock_post.when_,
|
published: inserted_mod_lock_post.published,
|
||||||
};
|
};
|
||||||
|
|
||||||
// feature post
|
// feature post
|
||||||
|
@ -466,8 +476,8 @@ mod tests {
|
||||||
let mod_feature_post_form = ModFeaturePostForm {
|
let mod_feature_post_form = ModFeaturePostForm {
|
||||||
mod_person_id: inserted_mod.id,
|
mod_person_id: inserted_mod.id,
|
||||||
post_id: inserted_post.id,
|
post_id: inserted_post.id,
|
||||||
featured: false,
|
featured: Some(false),
|
||||||
is_featured_community: true,
|
is_featured_community: Some(true),
|
||||||
};
|
};
|
||||||
let inserted_mod_feature_post = ModFeaturePost::create(pool, &mod_feature_post_form).await?;
|
let inserted_mod_feature_post = ModFeaturePost::create(pool, &mod_feature_post_form).await?;
|
||||||
let read_mod_feature_post = ModFeaturePost::read(pool, inserted_mod_feature_post.id).await?;
|
let read_mod_feature_post = ModFeaturePost::read(pool, inserted_mod_feature_post.id).await?;
|
||||||
|
@ -477,7 +487,7 @@ mod tests {
|
||||||
mod_person_id: inserted_mod.id,
|
mod_person_id: inserted_mod.id,
|
||||||
featured: false,
|
featured: false,
|
||||||
is_featured_community: true,
|
is_featured_community: true,
|
||||||
when_: inserted_mod_feature_post.when_,
|
published: inserted_mod_feature_post.published,
|
||||||
};
|
};
|
||||||
|
|
||||||
// comment
|
// comment
|
||||||
|
@ -498,7 +508,7 @@ mod tests {
|
||||||
mod_person_id: inserted_mod.id,
|
mod_person_id: inserted_mod.id,
|
||||||
reason: None,
|
reason: None,
|
||||||
removed: true,
|
removed: true,
|
||||||
when_: inserted_mod_remove_comment.when_,
|
published: inserted_mod_remove_comment.published,
|
||||||
};
|
};
|
||||||
|
|
||||||
// community
|
// community
|
||||||
|
@ -519,7 +529,7 @@ mod tests {
|
||||||
mod_person_id: inserted_mod.id,
|
mod_person_id: inserted_mod.id,
|
||||||
reason: None,
|
reason: None,
|
||||||
removed: true,
|
removed: true,
|
||||||
when_: inserted_mod_remove_community.when_,
|
published: inserted_mod_remove_community.published,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ban from community
|
// ban from community
|
||||||
|
@ -544,7 +554,7 @@ mod tests {
|
||||||
reason: None,
|
reason: None,
|
||||||
banned: true,
|
banned: true,
|
||||||
expires: None,
|
expires: None,
|
||||||
when_: inserted_mod_ban_from_community.when_,
|
published: inserted_mod_ban_from_community.published,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ban
|
// ban
|
||||||
|
@ -565,7 +575,7 @@ mod tests {
|
||||||
reason: None,
|
reason: None,
|
||||||
banned: true,
|
banned: true,
|
||||||
expires: None,
|
expires: None,
|
||||||
when_: inserted_mod_ban.when_,
|
published: inserted_mod_ban.published,
|
||||||
};
|
};
|
||||||
|
|
||||||
// mod add community
|
// mod add community
|
||||||
|
@ -584,7 +594,7 @@ mod tests {
|
||||||
mod_person_id: inserted_mod.id,
|
mod_person_id: inserted_mod.id,
|
||||||
other_person_id: inserted_person.id,
|
other_person_id: inserted_person.id,
|
||||||
removed: false,
|
removed: false,
|
||||||
when_: inserted_mod_add_community.when_,
|
published: inserted_mod_add_community.published,
|
||||||
};
|
};
|
||||||
|
|
||||||
// mod add
|
// mod add
|
||||||
|
@ -601,7 +611,7 @@ mod tests {
|
||||||
mod_person_id: inserted_mod.id,
|
mod_person_id: inserted_mod.id,
|
||||||
other_person_id: inserted_person.id,
|
other_person_id: inserted_person.id,
|
||||||
removed: false,
|
removed: false,
|
||||||
when_: inserted_mod_add.when_,
|
published: inserted_mod_add.published,
|
||||||
};
|
};
|
||||||
|
|
||||||
Comment::delete(pool, inserted_comment.id).await?;
|
Comment::delete(pool, inserted_comment.id).await?;
|
||||||
|
|
|
@ -280,6 +280,13 @@ pub enum FederationMode {
|
||||||
Disable,
|
Disable,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait InternalToCombinedView {
|
||||||
|
type CombinedView;
|
||||||
|
|
||||||
|
/// Maps the combined DB row to an enum
|
||||||
|
fn map_to_enum(self) -> Option<Self::CombinedView>;
|
||||||
|
}
|
||||||
|
|
||||||
/// Wrapper for assert_eq! macro. Checks that vec matches the given length, and prints the
|
/// Wrapper for assert_eq! macro. Checks that vec matches the given length, and prints the
|
||||||
/// vec on failure.
|
/// vec on failure.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|
|
@ -200,6 +200,95 @@ pub struct PersonContentCombinedId(i32);
|
||||||
/// The person saved combined id
|
/// The person saved combined id
|
||||||
pub struct PersonSavedCombinedId(i32);
|
pub struct PersonSavedCombinedId(i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
|
pub struct ModlogCombinedId(i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct AdminAllowInstanceId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct AdminBlockInstanceId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct AdminPurgePersonId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct AdminPurgeCommunityId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct AdminPurgeCommentId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct AdminPurgePostId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModRemovePostId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModRemoveCommentId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModRemoveCommunityId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModLockPostId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModFeaturePostId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModBanFromCommunityId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModBanId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModHideCommunityId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModAddCommunityId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModTransferCommunityId(pub i32);
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ModAddId(pub i32);
|
||||||
|
|
||||||
impl DbUrl {
|
impl DbUrl {
|
||||||
pub fn inner(&self) -> &Url {
|
pub fn inner(&self) -> &Url {
|
||||||
&self.0
|
&self.0
|
||||||
|
|
|
@ -49,7 +49,7 @@ diesel::table! {
|
||||||
admin_person_id -> Int4,
|
admin_person_id -> Int4,
|
||||||
allowed -> Bool,
|
allowed -> Bool,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ diesel::table! {
|
||||||
blocked -> Bool,
|
blocked -> Bool,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
expires -> Nullable<Timestamptz>,
|
expires -> Nullable<Timestamptz>,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ diesel::table! {
|
||||||
admin_person_id -> Int4,
|
admin_person_id -> Int4,
|
||||||
post_id -> Int4,
|
post_id -> Int4,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ diesel::table! {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
admin_person_id -> Int4,
|
admin_person_id -> Int4,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ diesel::table! {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
admin_person_id -> Int4,
|
admin_person_id -> Int4,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ diesel::table! {
|
||||||
admin_person_id -> Int4,
|
admin_person_id -> Int4,
|
||||||
community_id -> Int4,
|
community_id -> Int4,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ diesel::table! {
|
||||||
mod_person_id -> Int4,
|
mod_person_id -> Int4,
|
||||||
other_person_id -> Int4,
|
other_person_id -> Int4,
|
||||||
removed -> Bool,
|
removed -> Bool,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ diesel::table! {
|
||||||
other_person_id -> Int4,
|
other_person_id -> Int4,
|
||||||
community_id -> Int4,
|
community_id -> Int4,
|
||||||
removed -> Bool,
|
removed -> Bool,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +562,7 @@ diesel::table! {
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
banned -> Bool,
|
banned -> Bool,
|
||||||
expires -> Nullable<Timestamptz>,
|
expires -> Nullable<Timestamptz>,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ diesel::table! {
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
banned -> Bool,
|
banned -> Bool,
|
||||||
expires -> Nullable<Timestamptz>,
|
expires -> Nullable<Timestamptz>,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ diesel::table! {
|
||||||
mod_person_id -> Int4,
|
mod_person_id -> Int4,
|
||||||
post_id -> Int4,
|
post_id -> Int4,
|
||||||
featured -> Bool,
|
featured -> Bool,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
is_featured_community -> Bool,
|
is_featured_community -> Bool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ diesel::table! {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
community_id -> Int4,
|
community_id -> Int4,
|
||||||
mod_person_id -> Int4,
|
mod_person_id -> Int4,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
hidden -> Bool,
|
hidden -> Bool,
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ diesel::table! {
|
||||||
mod_person_id -> Int4,
|
mod_person_id -> Int4,
|
||||||
post_id -> Int4,
|
post_id -> Int4,
|
||||||
locked -> Bool,
|
locked -> Bool,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,7 +618,7 @@ diesel::table! {
|
||||||
comment_id -> Int4,
|
comment_id -> Int4,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
removed -> Bool,
|
removed -> Bool,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ diesel::table! {
|
||||||
community_id -> Int4,
|
community_id -> Int4,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
removed -> Bool,
|
removed -> Bool,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ diesel::table! {
|
||||||
post_id -> Int4,
|
post_id -> Int4,
|
||||||
reason -> Nullable<Text>,
|
reason -> Nullable<Text>,
|
||||||
removed -> Bool,
|
removed -> Bool,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,7 +650,31 @@ diesel::table! {
|
||||||
mod_person_id -> Int4,
|
mod_person_id -> Int4,
|
||||||
other_person_id -> Int4,
|
other_person_id -> Int4,
|
||||||
community_id -> Int4,
|
community_id -> Int4,
|
||||||
when_ -> Timestamptz,
|
published -> Timestamptz,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
modlog_combined (id) {
|
||||||
|
id -> Int4,
|
||||||
|
published -> Timestamptz,
|
||||||
|
admin_allow_instance_id -> Nullable<Int4>,
|
||||||
|
admin_block_instance_id -> Nullable<Int4>,
|
||||||
|
admin_purge_comment_id -> Nullable<Int4>,
|
||||||
|
admin_purge_community_id -> Nullable<Int4>,
|
||||||
|
admin_purge_person_id -> Nullable<Int4>,
|
||||||
|
admin_purge_post_id -> Nullable<Int4>,
|
||||||
|
mod_add_id -> Nullable<Int4>,
|
||||||
|
mod_add_community_id -> Nullable<Int4>,
|
||||||
|
mod_ban_id -> Nullable<Int4>,
|
||||||
|
mod_ban_from_community_id -> Nullable<Int4>,
|
||||||
|
mod_feature_post_id -> Nullable<Int4>,
|
||||||
|
mod_hide_community_id -> Nullable<Int4>,
|
||||||
|
mod_lock_post_id -> Nullable<Int4>,
|
||||||
|
mod_remove_comment_id -> Nullable<Int4>,
|
||||||
|
mod_remove_community_id -> Nullable<Int4>,
|
||||||
|
mod_remove_post_id -> Nullable<Int4>,
|
||||||
|
mod_transfer_community_id -> Nullable<Int4>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1093,6 +1117,23 @@ diesel::joinable!(mod_remove_community -> person (mod_person_id));
|
||||||
diesel::joinable!(mod_remove_post -> person (mod_person_id));
|
diesel::joinable!(mod_remove_post -> person (mod_person_id));
|
||||||
diesel::joinable!(mod_remove_post -> post (post_id));
|
diesel::joinable!(mod_remove_post -> post (post_id));
|
||||||
diesel::joinable!(mod_transfer_community -> community (community_id));
|
diesel::joinable!(mod_transfer_community -> community (community_id));
|
||||||
|
diesel::joinable!(modlog_combined -> admin_allow_instance (admin_allow_instance_id));
|
||||||
|
diesel::joinable!(modlog_combined -> admin_block_instance (admin_block_instance_id));
|
||||||
|
diesel::joinable!(modlog_combined -> admin_purge_comment (admin_purge_comment_id));
|
||||||
|
diesel::joinable!(modlog_combined -> admin_purge_community (admin_purge_community_id));
|
||||||
|
diesel::joinable!(modlog_combined -> admin_purge_person (admin_purge_person_id));
|
||||||
|
diesel::joinable!(modlog_combined -> admin_purge_post (admin_purge_post_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_add (mod_add_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_add_community (mod_add_community_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_ban (mod_ban_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_ban_from_community (mod_ban_from_community_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_feature_post (mod_feature_post_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_hide_community (mod_hide_community_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_lock_post (mod_lock_post_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_remove_comment (mod_remove_comment_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_remove_community (mod_remove_community_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_remove_post (mod_remove_post_id));
|
||||||
|
diesel::joinable!(modlog_combined -> mod_transfer_community (mod_transfer_community_id));
|
||||||
diesel::joinable!(oauth_account -> local_user (local_user_id));
|
diesel::joinable!(oauth_account -> local_user (local_user_id));
|
||||||
diesel::joinable!(oauth_account -> oauth_provider (oauth_provider_id));
|
diesel::joinable!(oauth_account -> oauth_provider (oauth_provider_id));
|
||||||
diesel::joinable!(password_reset_request -> local_user (local_user_id));
|
diesel::joinable!(password_reset_request -> local_user (local_user_id));
|
||||||
|
@ -1178,6 +1219,7 @@ diesel::allow_tables_to_appear_in_same_query!(
|
||||||
mod_remove_community,
|
mod_remove_community,
|
||||||
mod_remove_post,
|
mod_remove_post,
|
||||||
mod_transfer_community,
|
mod_transfer_community,
|
||||||
|
modlog_combined,
|
||||||
oauth_account,
|
oauth_account,
|
||||||
oauth_provider,
|
oauth_provider,
|
||||||
password_reset_request,
|
password_reset_request,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
pub mod modlog;
|
||||||
pub mod person_content;
|
pub mod person_content;
|
||||||
pub mod person_saved;
|
pub mod person_saved;
|
||||||
pub mod report;
|
pub mod report;
|
||||||
|
|
57
crates/db_schema/src/source/combined/modlog.rs
Normal file
57
crates/db_schema/src/source/combined/modlog.rs
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
use crate::newtypes::{
|
||||||
|
AdminAllowInstanceId,
|
||||||
|
AdminBlockInstanceId,
|
||||||
|
AdminPurgeCommentId,
|
||||||
|
AdminPurgeCommunityId,
|
||||||
|
AdminPurgePersonId,
|
||||||
|
AdminPurgePostId,
|
||||||
|
ModAddCommunityId,
|
||||||
|
ModAddId,
|
||||||
|
ModBanFromCommunityId,
|
||||||
|
ModBanId,
|
||||||
|
ModFeaturePostId,
|
||||||
|
ModHideCommunityId,
|
||||||
|
ModLockPostId,
|
||||||
|
ModRemoveCommentId,
|
||||||
|
ModRemoveCommunityId,
|
||||||
|
ModRemovePostId,
|
||||||
|
ModTransferCommunityId,
|
||||||
|
ModlogCombinedId,
|
||||||
|
};
|
||||||
|
#[cfg(feature = "full")]
|
||||||
|
use crate::schema::modlog_combined;
|
||||||
|
use chrono::{DateTime, Utc};
|
||||||
|
#[cfg(feature = "full")]
|
||||||
|
use i_love_jesus::CursorKeysModule;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "full",
|
||||||
|
derive(Identifiable, Queryable, Selectable, CursorKeysModule)
|
||||||
|
)]
|
||||||
|
#[cfg_attr(feature = "full", diesel(table_name = modlog_combined))]
|
||||||
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
|
#[cfg_attr(feature = "full", cursor_keys_module(name = modlog_combined_keys))]
|
||||||
|
/// A combined modlog table.
|
||||||
|
pub struct ModlogCombined {
|
||||||
|
pub id: ModlogCombinedId,
|
||||||
|
pub published: DateTime<Utc>,
|
||||||
|
pub admin_allow_instance_id: Option<AdminAllowInstanceId>,
|
||||||
|
pub admin_block_instance_id: Option<AdminBlockInstanceId>,
|
||||||
|
pub admin_purge_comment_id: Option<AdminPurgeCommentId>,
|
||||||
|
pub admin_purge_community_id: Option<AdminPurgeCommunityId>,
|
||||||
|
pub admin_purge_person_id: Option<AdminPurgePersonId>,
|
||||||
|
pub admin_purge_post_id: Option<AdminPurgePostId>,
|
||||||
|
pub mod_add_id: Option<ModAddId>,
|
||||||
|
pub mod_add_community_id: Option<ModAddCommunityId>,
|
||||||
|
pub mod_ban_id: Option<ModBanId>,
|
||||||
|
pub mod_ban_from_community_id: Option<ModBanFromCommunityId>,
|
||||||
|
pub mod_feature_post_id: Option<ModFeaturePostId>,
|
||||||
|
pub mod_hide_community_id: Option<ModHideCommunityId>,
|
||||||
|
pub mod_lock_post_id: Option<ModLockPostId>,
|
||||||
|
pub mod_remove_comment_id: Option<ModRemoveCommentId>,
|
||||||
|
pub mod_remove_community_id: Option<ModRemoveCommunityId>,
|
||||||
|
pub mod_remove_post_id: Option<ModRemovePostId>,
|
||||||
|
pub mod_transfer_community_id: Option<ModTransferCommunityId>,
|
||||||
|
}
|
|
@ -1,4 +1,15 @@
|
||||||
use crate::newtypes::{CommunityId, InstanceId, PersonId, PostId};
|
use crate::newtypes::{
|
||||||
|
AdminAllowInstanceId,
|
||||||
|
AdminBlockInstanceId,
|
||||||
|
AdminPurgeCommentId,
|
||||||
|
AdminPurgeCommunityId,
|
||||||
|
AdminPurgePersonId,
|
||||||
|
AdminPurgePostId,
|
||||||
|
CommunityId,
|
||||||
|
InstanceId,
|
||||||
|
PersonId,
|
||||||
|
PostId,
|
||||||
|
};
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use crate::schema::{
|
use crate::schema::{
|
||||||
admin_allow_instance,
|
admin_allow_instance,
|
||||||
|
@ -22,11 +33,11 @@ use ts_rs::TS;
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When an admin purges a person.
|
/// When an admin purges a person.
|
||||||
pub struct AdminPurgePerson {
|
pub struct AdminPurgePerson {
|
||||||
pub id: i32,
|
pub id: AdminPurgePersonId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -44,11 +55,11 @@ pub struct AdminPurgePersonForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When an admin purges a community.
|
/// When an admin purges a community.
|
||||||
pub struct AdminPurgeCommunity {
|
pub struct AdminPurgeCommunity {
|
||||||
pub id: i32,
|
pub id: AdminPurgeCommunityId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -66,12 +77,12 @@ pub struct AdminPurgeCommunityForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When an admin purges a post.
|
/// When an admin purges a post.
|
||||||
pub struct AdminPurgePost {
|
pub struct AdminPurgePost {
|
||||||
pub id: i32,
|
pub id: AdminPurgePostId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -90,12 +101,12 @@ pub struct AdminPurgePostForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When an admin purges a comment.
|
/// When an admin purges a comment.
|
||||||
pub struct AdminPurgeComment {
|
pub struct AdminPurgeComment {
|
||||||
pub id: i32,
|
pub id: AdminPurgeCommentId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -120,13 +131,13 @@ pub struct AdminPurgeCommentForm {
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
pub struct AdminAllowInstance {
|
pub struct AdminAllowInstance {
|
||||||
pub id: i32,
|
pub id: AdminAllowInstanceId,
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub allowed: bool,
|
pub allowed: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
|
@ -153,7 +164,7 @@ pub struct AdminAllowInstanceForm {
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
pub struct AdminBlockInstance {
|
pub struct AdminBlockInstance {
|
||||||
pub id: i32,
|
pub id: AdminBlockInstanceId,
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub blocked: bool,
|
pub blocked: bool,
|
||||||
|
@ -161,7 +172,7 @@ pub struct AdminBlockInstance {
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub expires: Option<DateTime<Utc>>,
|
pub expires: Option<DateTime<Utc>>,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
|
@ -172,5 +183,4 @@ pub struct AdminBlockInstanceForm {
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub blocked: bool,
|
pub blocked: bool,
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: Option<DateTime<Utc>>,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
use crate::newtypes::{CommentId, CommunityId, PersonId, PostId};
|
use crate::newtypes::{
|
||||||
|
CommentId,
|
||||||
|
CommunityId,
|
||||||
|
ModAddCommunityId,
|
||||||
|
ModAddId,
|
||||||
|
ModBanFromCommunityId,
|
||||||
|
ModBanId,
|
||||||
|
ModFeaturePostId,
|
||||||
|
ModHideCommunityId,
|
||||||
|
ModLockPostId,
|
||||||
|
ModRemoveCommentId,
|
||||||
|
ModRemoveCommunityId,
|
||||||
|
ModRemovePostId,
|
||||||
|
ModTransferCommunityId,
|
||||||
|
PersonId,
|
||||||
|
PostId,
|
||||||
|
};
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use crate::schema::{
|
use crate::schema::{
|
||||||
mod_add,
|
mod_add,
|
||||||
|
@ -27,13 +43,13 @@ use ts_rs::TS;
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When a moderator removes a post.
|
/// When a moderator removes a post.
|
||||||
pub struct ModRemovePost {
|
pub struct ModRemovePost {
|
||||||
pub id: i32,
|
pub id: ModRemovePostId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -52,11 +68,11 @@ pub struct ModRemovePostForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When a moderator locks a post (prevents new comments being made).
|
/// When a moderator locks a post (prevents new comments being made).
|
||||||
pub struct ModLockPost {
|
pub struct ModLockPost {
|
||||||
pub id: i32,
|
pub id: ModLockPostId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
pub locked: bool,
|
pub locked: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -74,11 +90,11 @@ pub struct ModLockPostForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When a moderator features a post on a community (pins it to the top).
|
/// When a moderator features a post on a community (pins it to the top).
|
||||||
pub struct ModFeaturePost {
|
pub struct ModFeaturePost {
|
||||||
pub id: i32,
|
pub id: ModFeaturePostId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
pub featured: bool,
|
pub featured: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
pub is_featured_community: bool,
|
pub is_featured_community: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +103,8 @@ pub struct ModFeaturePost {
|
||||||
pub struct ModFeaturePostForm {
|
pub struct ModFeaturePostForm {
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
pub featured: bool,
|
pub featured: Option<bool>,
|
||||||
pub is_featured_community: bool,
|
pub is_featured_community: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
|
@ -99,13 +115,13 @@ pub struct ModFeaturePostForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When a moderator removes a comment.
|
/// When a moderator removes a comment.
|
||||||
pub struct ModRemoveComment {
|
pub struct ModRemoveComment {
|
||||||
pub id: i32,
|
pub id: ModRemoveCommentId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -125,13 +141,13 @@ pub struct ModRemoveCommentForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When a moderator removes a community.
|
/// When a moderator removes a community.
|
||||||
pub struct ModRemoveCommunity {
|
pub struct ModRemoveCommunity {
|
||||||
pub id: i32,
|
pub id: ModRemoveCommunityId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -151,7 +167,7 @@ pub struct ModRemoveCommunityForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When someone is banned from a community.
|
/// When someone is banned from a community.
|
||||||
pub struct ModBanFromCommunity {
|
pub struct ModBanFromCommunity {
|
||||||
pub id: i32,
|
pub id: ModBanFromCommunityId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub other_person_id: PersonId,
|
pub other_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
|
@ -160,7 +176,7 @@ pub struct ModBanFromCommunity {
|
||||||
pub banned: bool,
|
pub banned: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub expires: Option<DateTime<Utc>>,
|
pub expires: Option<DateTime<Utc>>,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -182,7 +198,7 @@ pub struct ModBanFromCommunityForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When someone is banned from the site.
|
/// When someone is banned from the site.
|
||||||
pub struct ModBan {
|
pub struct ModBan {
|
||||||
pub id: i32,
|
pub id: ModBanId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub other_person_id: PersonId,
|
pub other_person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
|
@ -190,7 +206,7 @@ pub struct ModBan {
|
||||||
pub banned: bool,
|
pub banned: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub expires: Option<DateTime<Utc>>,
|
pub expires: Option<DateTime<Utc>>,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -210,10 +226,10 @@ pub struct ModHideCommunityForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When a community is hidden from public view.
|
/// When a community is hidden from public view.
|
||||||
pub struct ModHideCommunity {
|
pub struct ModHideCommunity {
|
||||||
pub id: i32,
|
pub id: ModHideCommunityId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
|
@ -236,12 +252,12 @@ pub struct ModBanForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When someone is added as a community moderator.
|
/// When someone is added as a community moderator.
|
||||||
pub struct ModAddCommunity {
|
pub struct ModAddCommunity {
|
||||||
pub id: i32,
|
pub id: ModAddCommunityId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub other_person_id: PersonId,
|
pub other_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -260,11 +276,11 @@ pub struct ModAddCommunityForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When a moderator transfers a community to a new owner.
|
/// When a moderator transfers a community to a new owner.
|
||||||
pub struct ModTransferCommunity {
|
pub struct ModTransferCommunity {
|
||||||
pub id: i32,
|
pub id: ModTransferCommunityId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub other_person_id: PersonId,
|
pub other_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
@ -282,11 +298,11 @@ pub struct ModTransferCommunityForm {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When someone is added as a site moderator.
|
/// When someone is added as a site moderator.
|
||||||
pub struct ModAdd {
|
pub struct ModAdd {
|
||||||
pub id: i32,
|
pub id: ModAddId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub other_person_id: PersonId,
|
pub other_person_id: PersonId,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
|
|
|
@ -34,10 +34,3 @@ pub mod site_view;
|
||||||
pub mod structs;
|
pub mod structs;
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
pub mod vote_view;
|
pub mod vote_view;
|
||||||
|
|
||||||
pub trait InternalToCombinedView {
|
|
||||||
type CombinedView;
|
|
||||||
|
|
||||||
/// Maps the combined DB row to an enum
|
|
||||||
fn map_to_enum(&self) -> Option<Self::CombinedView>;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
use crate::{
|
use crate::structs::{
|
||||||
structs::{
|
CommentView,
|
||||||
CommentView,
|
LocalUserView,
|
||||||
LocalUserView,
|
PersonContentCombinedPaginationCursor,
|
||||||
PersonContentCombinedPaginationCursor,
|
PersonContentCombinedView,
|
||||||
PersonContentCombinedView,
|
PersonContentViewInternal,
|
||||||
PersonContentViewInternal,
|
PostView,
|
||||||
PostView,
|
|
||||||
},
|
|
||||||
InternalToCombinedView,
|
|
||||||
};
|
};
|
||||||
use diesel::{
|
use diesel::{
|
||||||
result::Error,
|
result::Error,
|
||||||
|
@ -45,6 +42,7 @@ use lemmy_db_schema::{
|
||||||
community::CommunityFollower,
|
community::CommunityFollower,
|
||||||
},
|
},
|
||||||
utils::{actions, actions_alias, functions::coalesce, get_conn, DbPool},
|
utils::{actions, actions_alias, functions::coalesce, get_conn, DbPool},
|
||||||
|
InternalToCombinedView,
|
||||||
PersonContentType,
|
PersonContentType,
|
||||||
};
|
};
|
||||||
use lemmy_utils::error::LemmyResult;
|
use lemmy_utils::error::LemmyResult;
|
||||||
|
@ -240,7 +238,10 @@ impl PersonContentCombinedQuery {
|
||||||
let res = query.load::<PersonContentViewInternal>(conn).await?;
|
let res = query.load::<PersonContentViewInternal>(conn).await?;
|
||||||
|
|
||||||
// Map the query results to the enum
|
// Map the query results to the enum
|
||||||
let out = res.into_iter().filter_map(|u| u.map_to_enum()).collect();
|
let out = res
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(InternalToCombinedView::map_to_enum)
|
||||||
|
.collect();
|
||||||
|
|
||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
@ -249,9 +250,9 @@ impl PersonContentCombinedQuery {
|
||||||
impl InternalToCombinedView for PersonContentViewInternal {
|
impl InternalToCombinedView for PersonContentViewInternal {
|
||||||
type CombinedView = PersonContentCombinedView;
|
type CombinedView = PersonContentCombinedView;
|
||||||
|
|
||||||
fn map_to_enum(&self) -> Option<Self::CombinedView> {
|
fn map_to_enum(self) -> Option<Self::CombinedView> {
|
||||||
// Use for a short alias
|
// Use for a short alias
|
||||||
let v = self.clone();
|
let v = self;
|
||||||
|
|
||||||
if let (Some(comment), Some(counts)) = (v.comment, v.comment_counts) {
|
if let (Some(comment), Some(counts)) = (v.comment, v.comment_counts) {
|
||||||
Some(PersonContentCombinedView::Comment(CommentView {
|
Some(PersonContentCombinedView::Comment(CommentView {
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
use crate::{
|
use crate::structs::{
|
||||||
structs::{
|
LocalUserView,
|
||||||
LocalUserView,
|
PersonContentCombinedView,
|
||||||
PersonContentCombinedView,
|
PersonContentViewInternal,
|
||||||
PersonContentViewInternal,
|
PersonSavedCombinedPaginationCursor,
|
||||||
PersonSavedCombinedPaginationCursor,
|
|
||||||
},
|
|
||||||
InternalToCombinedView,
|
|
||||||
};
|
};
|
||||||
use diesel::{
|
use diesel::{
|
||||||
result::Error,
|
result::Error,
|
||||||
|
@ -42,6 +39,7 @@ use lemmy_db_schema::{
|
||||||
community::CommunityFollower,
|
community::CommunityFollower,
|
||||||
},
|
},
|
||||||
utils::{actions, actions_alias, functions::coalesce, get_conn, DbPool},
|
utils::{actions, actions_alias, functions::coalesce, get_conn, DbPool},
|
||||||
|
InternalToCombinedView,
|
||||||
PersonContentType,
|
PersonContentType,
|
||||||
};
|
};
|
||||||
use lemmy_utils::error::LemmyResult;
|
use lemmy_utils::error::LemmyResult;
|
||||||
|
@ -241,7 +239,10 @@ impl PersonSavedCombinedQuery {
|
||||||
let res = query.load::<PersonContentViewInternal>(conn).await?;
|
let res = query.load::<PersonContentViewInternal>(conn).await?;
|
||||||
|
|
||||||
// Map the query results to the enum
|
// Map the query results to the enum
|
||||||
let out = res.into_iter().filter_map(|u| u.map_to_enum()).collect();
|
let out = res
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(InternalToCombinedView::map_to_enum)
|
||||||
|
.collect();
|
||||||
|
|
||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
use crate::{
|
use crate::structs::{
|
||||||
structs::{
|
CommentReportView,
|
||||||
CommentReportView,
|
CommunityReportView,
|
||||||
CommunityReportView,
|
LocalUserView,
|
||||||
LocalUserView,
|
PostReportView,
|
||||||
PostReportView,
|
PrivateMessageReportView,
|
||||||
PrivateMessageReportView,
|
ReportCombinedPaginationCursor,
|
||||||
ReportCombinedPaginationCursor,
|
ReportCombinedView,
|
||||||
ReportCombinedView,
|
ReportCombinedViewInternal,
|
||||||
ReportCombinedViewInternal,
|
|
||||||
},
|
|
||||||
InternalToCombinedView,
|
|
||||||
};
|
};
|
||||||
use diesel::{
|
use diesel::{
|
||||||
result::Error,
|
result::Error,
|
||||||
|
@ -51,6 +48,7 @@ use lemmy_db_schema::{
|
||||||
community::CommunityFollower,
|
community::CommunityFollower,
|
||||||
},
|
},
|
||||||
utils::{actions, actions_alias, functions::coalesce, get_conn, DbPool, ReverseTimestampKey},
|
utils::{actions, actions_alias, functions::coalesce, get_conn, DbPool, ReverseTimestampKey},
|
||||||
|
InternalToCombinedView,
|
||||||
};
|
};
|
||||||
use lemmy_utils::error::LemmyResult;
|
use lemmy_utils::error::LemmyResult;
|
||||||
|
|
||||||
|
@ -363,7 +361,10 @@ impl ReportCombinedQuery {
|
||||||
let res = query.load::<ReportCombinedViewInternal>(conn).await?;
|
let res = query.load::<ReportCombinedViewInternal>(conn).await?;
|
||||||
|
|
||||||
// Map the query results to the enum
|
// Map the query results to the enum
|
||||||
let out = res.into_iter().filter_map(|u| u.map_to_enum()).collect();
|
let out = res
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(InternalToCombinedView::map_to_enum)
|
||||||
|
.collect();
|
||||||
|
|
||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
@ -372,9 +373,9 @@ impl ReportCombinedQuery {
|
||||||
impl InternalToCombinedView for ReportCombinedViewInternal {
|
impl InternalToCombinedView for ReportCombinedViewInternal {
|
||||||
type CombinedView = ReportCombinedView;
|
type CombinedView = ReportCombinedView;
|
||||||
|
|
||||||
fn map_to_enum(&self) -> Option<Self::CombinedView> {
|
fn map_to_enum(self) -> Option<Self::CombinedView> {
|
||||||
// Use for a short alias
|
// Use for a short alias
|
||||||
let v = self.clone();
|
let v = self;
|
||||||
|
|
||||||
if let (
|
if let (
|
||||||
Some(post_report),
|
Some(post_report),
|
||||||
|
|
|
@ -148,25 +148,25 @@ pub struct PostReportView {
|
||||||
/// prevent ossification (api users love to make assumptions (e.g. parse stuff that looks like
|
/// prevent ossification (api users love to make assumptions (e.g. parse stuff that looks like
|
||||||
/// numbers as numbers) about apis that aren't part of the spec
|
/// numbers as numbers) about apis that aren't part of the spec
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(ts_rs::TS))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
pub struct PaginationCursor(pub String);
|
pub struct PaginationCursor(pub String);
|
||||||
|
|
||||||
/// like PaginationCursor but for the report_combined table
|
/// like PaginationCursor but for the report_combined table
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(ts_rs::TS))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
pub struct ReportCombinedPaginationCursor(pub String);
|
pub struct ReportCombinedPaginationCursor(pub String);
|
||||||
|
|
||||||
/// like PaginationCursor but for the person_content_combined table
|
/// like PaginationCursor but for the person_content_combined table
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(ts_rs::TS))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
pub struct PersonContentCombinedPaginationCursor(pub String);
|
pub struct PersonContentCombinedPaginationCursor(pub String);
|
||||||
|
|
||||||
/// like PaginationCursor but for the person_saved_combined table
|
/// like PaginationCursor but for the person_saved_combined table
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(ts_rs::TS))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
pub struct PersonSavedCombinedPaginationCursor(pub String);
|
pub struct PersonSavedCombinedPaginationCursor(pub String);
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,19 @@ doctest = false
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
full = ["lemmy_db_schema/full", "diesel", "diesel-async", "ts-rs"]
|
full = [
|
||||||
|
"lemmy_db_schema/full",
|
||||||
|
"lemmy_utils",
|
||||||
|
"i-love-jesus",
|
||||||
|
"diesel",
|
||||||
|
"diesel-async",
|
||||||
|
"ts-rs",
|
||||||
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
lemmy_utils = { workspace = true, optional = true }
|
||||||
|
i-love-jesus = { workspace = true, optional = true }
|
||||||
diesel = { workspace = true, features = [
|
diesel = { workspace = true, features = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"postgres",
|
"postgres",
|
||||||
|
@ -31,3 +40,8 @@ diesel-async = { workspace = true, features = [
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
serde_with = { workspace = true }
|
serde_with = { workspace = true }
|
||||||
ts-rs = { workspace = true, optional = true }
|
ts-rs = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
serial_test = { workspace = true }
|
||||||
|
tokio = { workspace = true }
|
||||||
|
pretty_assertions = { workspace = true }
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
use crate::structs::{AdminAllowInstanceView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{admin_allow_instance, instance, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl AdminAllowInstanceView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = admin_allow_instance::admin_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = admin_allow_instance::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(instance::table)
|
|
||||||
.select((
|
|
||||||
admin_allow_instance::all_columns,
|
|
||||||
instance::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(admin_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(admin_allow_instance::admin_person_id.eq(admin_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(admin_allow_instance::when_.desc())
|
|
||||||
.load::<Self>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
use crate::structs::{AdminBlockInstanceView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{admin_block_instance, instance, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl AdminBlockInstanceView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = admin_block_instance::admin_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = admin_block_instance::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(instance::table)
|
|
||||||
.select((
|
|
||||||
admin_block_instance::all_columns,
|
|
||||||
instance::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(admin_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(admin_block_instance::admin_person_id.eq(admin_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(admin_block_instance::when_.desc())
|
|
||||||
.load::<Self>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
use crate::structs::{AdminPurgeCommentView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{admin_purge_comment, person, post},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl AdminPurgeCommentView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = admin_purge_comment::admin_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
|
|
||||||
let mut query = admin_purge_comment::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(post::table)
|
|
||||||
.select((
|
|
||||||
admin_purge_comment::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
post::all_columns,
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(admin_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(admin_purge_comment::admin_person_id.eq(admin_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(admin_purge_comment::when_.desc())
|
|
||||||
.load::<AdminPurgeCommentView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
use crate::structs::{AdminPurgeCommunityView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{admin_purge_community, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl AdminPurgeCommunityView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = admin_purge_community::admin_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
|
|
||||||
let mut query = admin_purge_community::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.select((
|
|
||||||
admin_purge_community::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(admin_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(admin_purge_community::admin_person_id.eq(admin_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(admin_purge_community::when_.desc())
|
|
||||||
.load::<AdminPurgeCommunityView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
use crate::structs::{AdminPurgePersonView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{admin_purge_person, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl AdminPurgePersonView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = admin_purge_person::admin_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = admin_purge_person::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.select((
|
|
||||||
admin_purge_person::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(admin_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(admin_purge_person::admin_person_id.eq(admin_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(admin_purge_person::when_.desc())
|
|
||||||
.load::<AdminPurgePersonView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
use crate::structs::{AdminPurgePostView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{admin_purge_post, community, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl AdminPurgePostView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = admin_purge_post::admin_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = admin_purge_post::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(community::table)
|
|
||||||
.select((
|
|
||||||
admin_purge_post::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
community::all_columns,
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(admin_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(admin_purge_post::admin_person_id.eq(admin_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(admin_purge_post::when_.desc())
|
|
||||||
.load::<AdminPurgePostView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +1,3 @@
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
pub mod admin_allow_instance;
|
pub mod modlog_combined_view;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod admin_block_instance;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod admin_purge_comment_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod admin_purge_community_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod admin_purge_person_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod admin_purge_post_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_add_community_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_add_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_ban_from_community_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_ban_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_feature_post_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_hide_community_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_lock_post_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_remove_comment_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_remove_community_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_remove_post_view;
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
pub mod mod_transfer_community_view;
|
|
||||||
pub mod structs;
|
pub mod structs;
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
use crate::structs::{ModAddCommunityView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{community, mod_add_community, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModAddCommunityView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
let person_alias_1 = diesel::alias!(person as person1);
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_add_community::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_add_community::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(community::table)
|
|
||||||
.inner_join(
|
|
||||||
person_alias_1.on(mod_add_community::other_person_id.eq(person_alias_1.field(person::id))),
|
|
||||||
)
|
|
||||||
.select((
|
|
||||||
mod_add_community::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
community::all_columns,
|
|
||||||
person_alias_1.fields(person::all_columns),
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_add_community::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(community_id) = params.community_id {
|
|
||||||
query = query.filter(mod_add_community::community_id.eq(community_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(other_person_id) = params.other_person_id {
|
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_add_community::when_.desc())
|
|
||||||
.load::<ModAddCommunityView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
use crate::structs::{ModAddView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{mod_add, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModAddView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
let person_alias_1 = diesel::alias!(person as person1);
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_add::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_add::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(person_alias_1.on(mod_add::other_person_id.eq(person_alias_1.field(person::id))))
|
|
||||||
.select((
|
|
||||||
mod_add::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
person_alias_1.fields(person::all_columns),
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_add::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(other_person_id) = params.other_person_id {
|
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_add::when_.desc())
|
|
||||||
.load::<ModAddView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
use crate::structs::{ModBanFromCommunityView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{community, mod_ban_from_community, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModBanFromCommunityView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
|
|
||||||
let person_alias_1 = diesel::alias!(person as person1);
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_ban_from_community::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_ban_from_community::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(community::table)
|
|
||||||
.inner_join(
|
|
||||||
person_alias_1
|
|
||||||
.on(mod_ban_from_community::other_person_id.eq(person_alias_1.field(person::id))),
|
|
||||||
)
|
|
||||||
.select((
|
|
||||||
mod_ban_from_community::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
community::all_columns,
|
|
||||||
person_alias_1.fields(person::all_columns),
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_ban_from_community::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(community_id) = params.community_id {
|
|
||||||
query = query.filter(mod_ban_from_community::community_id.eq(community_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(other_person_id) = params.other_person_id {
|
|
||||||
query = query.filter(mod_ban_from_community::other_person_id.eq(other_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_ban_from_community::when_.desc())
|
|
||||||
.load::<ModBanFromCommunityView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
use crate::structs::{ModBanView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{mod_ban, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModBanView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
let person_alias_1 = diesel::alias!(person as person1);
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_ban::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_ban::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(person_alias_1.on(mod_ban::other_person_id.eq(person_alias_1.field(person::id))))
|
|
||||||
.select((
|
|
||||||
mod_ban::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
person_alias_1.fields(person::all_columns),
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_ban::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(other_person_id) = params.other_person_id {
|
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_ban::when_.desc())
|
|
||||||
.load::<ModBanView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
use crate::structs::{ModFeaturePostView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{community, mod_feature_post, person, post},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModFeaturePostView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
let person_alias_1 = diesel::alias!(person as person1);
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_feature_post::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_feature_post::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(post::table)
|
|
||||||
.inner_join(person_alias_1.on(post::creator_id.eq(person_alias_1.field(person::id))))
|
|
||||||
.inner_join(community::table.on(post::community_id.eq(community::id)))
|
|
||||||
.select((
|
|
||||||
mod_feature_post::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
post::all_columns,
|
|
||||||
community::all_columns,
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(community_id) = params.community_id {
|
|
||||||
query = query.filter(post::community_id.eq(community_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_feature_post::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(other_person_id) = params.other_person_id {
|
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(post_id) = params.post_id {
|
|
||||||
query = query.filter(post::id.eq(post_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a comment ID is given, then don't find any results
|
|
||||||
if params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_feature_post::when_.desc())
|
|
||||||
.load::<ModFeaturePostView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
use crate::structs::{ModHideCommunityView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{community, mod_hide_community, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModHideCommunityView {
|
|
||||||
// Pass in mod_id as admin_id because only admins can do this action
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_hide_community::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_hide_community::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(community::table.on(mod_hide_community::community_id.eq(community::id)))
|
|
||||||
.select((
|
|
||||||
mod_hide_community::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
community::all_columns,
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(community_id) = params.community_id {
|
|
||||||
query = query.filter(mod_hide_community::community_id.eq(community_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(admin_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_hide_community::mod_person_id.eq(admin_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_hide_community::when_.desc())
|
|
||||||
.load::<ModHideCommunityView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
use crate::structs::{ModLockPostView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{community, mod_lock_post, person, post},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModLockPostView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
|
|
||||||
let person_alias_1 = diesel::alias!(person as person1);
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_lock_post::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_lock_post::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(post::table)
|
|
||||||
.inner_join(community::table.on(post::community_id.eq(community::id)))
|
|
||||||
.inner_join(person_alias_1.on(post::creator_id.eq(person_alias_1.field(person::id))))
|
|
||||||
.select((
|
|
||||||
mod_lock_post::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
post::all_columns,
|
|
||||||
community::all_columns,
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(community_id) = params.community_id {
|
|
||||||
query = query.filter(post::community_id.eq(community_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_lock_post::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(other_person_id) = params.other_person_id {
|
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(post_id) = params.post_id {
|
|
||||||
query = query.filter(post::id.eq(post_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a comment ID is given, then don't find any results
|
|
||||||
if params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_lock_post::when_.desc())
|
|
||||||
.load::<ModLockPostView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
use crate::structs::{ModRemoveCommentView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{comment, community, mod_remove_comment, person, post},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModRemoveCommentView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
let person_alias_1 = diesel::alias!(lemmy_db_schema::schema::person as person1);
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_remove_comment::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_remove_comment::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(comment::table)
|
|
||||||
.inner_join(person_alias_1.on(comment::creator_id.eq(person_alias_1.field(person::id))))
|
|
||||||
.inner_join(post::table.on(comment::post_id.eq(post::id)))
|
|
||||||
.inner_join(community::table.on(post::community_id.eq(community::id)))
|
|
||||||
.select((
|
|
||||||
mod_remove_comment::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
comment::all_columns,
|
|
||||||
person_alias_1.fields(person::all_columns),
|
|
||||||
post::all_columns,
|
|
||||||
community::all_columns,
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(community_id) = params.community_id {
|
|
||||||
query = query.filter(post::community_id.eq(community_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_remove_comment::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(other_person_id) = params.other_person_id {
|
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(comment_id) = params.comment_id {
|
|
||||||
query = query.filter(comment::id.eq(comment_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a post ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_remove_comment::when_.desc())
|
|
||||||
.load::<ModRemoveCommentView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
use crate::structs::{ModRemoveCommunityView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{community, mod_remove_community, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModRemoveCommunityView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_remove_community::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_remove_community::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(community::table)
|
|
||||||
.select((
|
|
||||||
mod_remove_community::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
community::all_columns,
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_remove_community::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_remove_community::when_.desc())
|
|
||||||
.load::<ModRemoveCommunityView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
use crate::structs::{ModRemovePostView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{community, mod_remove_post, person, post},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModRemovePostView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
|
|
||||||
let person_alias_1 = diesel::alias!(person as person1);
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_remove_post::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_remove_post::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(post::table)
|
|
||||||
.inner_join(community::table.on(post::community_id.eq(community::id)))
|
|
||||||
.inner_join(person_alias_1.on(post::creator_id.eq(person_alias_1.field(person::id))))
|
|
||||||
.select((
|
|
||||||
mod_remove_post::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
post::all_columns,
|
|
||||||
community::all_columns,
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(community_id) = params.community_id {
|
|
||||||
query = query.filter(post::community_id.eq(community_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_remove_post::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(other_person_id) = params.other_person_id {
|
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(post_id) = params.post_id {
|
|
||||||
query = query.filter(post::id.eq(post_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a comment ID is given, then don't find any results
|
|
||||||
if params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_remove_post::when_.desc())
|
|
||||||
.load::<ModRemovePostView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
use crate::structs::{ModTransferCommunityView, ModlogListParams};
|
|
||||||
use diesel::{
|
|
||||||
result::Error,
|
|
||||||
BoolExpressionMethods,
|
|
||||||
ExpressionMethods,
|
|
||||||
IntoSql,
|
|
||||||
JoinOnDsl,
|
|
||||||
NullableExpressionMethods,
|
|
||||||
QueryDsl,
|
|
||||||
};
|
|
||||||
use diesel_async::RunQueryDsl;
|
|
||||||
use lemmy_db_schema::{
|
|
||||||
newtypes::PersonId,
|
|
||||||
schema::{community, mod_transfer_community, person},
|
|
||||||
utils::{get_conn, limit_and_offset, DbPool},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl ModTransferCommunityView {
|
|
||||||
pub async fn list(pool: &mut DbPool<'_>, params: ModlogListParams) -> Result<Vec<Self>, Error> {
|
|
||||||
let conn = &mut get_conn(pool).await?;
|
|
||||||
|
|
||||||
let person_alias_1 = diesel::alias!(person as person1);
|
|
||||||
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
|
|
||||||
let show_mod_names = !params.hide_modlog_names;
|
|
||||||
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
|
|
||||||
|
|
||||||
let admin_names_join = mod_transfer_community::mod_person_id
|
|
||||||
.eq(person::id)
|
|
||||||
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
|
|
||||||
let mut query = mod_transfer_community::table
|
|
||||||
.left_join(person::table.on(admin_names_join))
|
|
||||||
.inner_join(community::table)
|
|
||||||
.inner_join(
|
|
||||||
person_alias_1
|
|
||||||
.on(mod_transfer_community::other_person_id.eq(person_alias_1.field(person::id))),
|
|
||||||
)
|
|
||||||
.select((
|
|
||||||
mod_transfer_community::all_columns,
|
|
||||||
person::all_columns.nullable(),
|
|
||||||
community::all_columns,
|
|
||||||
person_alias_1.fields(person::all_columns),
|
|
||||||
))
|
|
||||||
.into_boxed();
|
|
||||||
|
|
||||||
if let Some(mod_person_id) = params.mod_person_id {
|
|
||||||
query = query.filter(mod_transfer_community::mod_person_id.eq(mod_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(community_id) = params.community_id {
|
|
||||||
query = query.filter(mod_transfer_community::community_id.eq(community_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(other_person_id) = params.other_person_id {
|
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
|
||||||
};
|
|
||||||
|
|
||||||
// If a post or comment ID is given, then don't find any results
|
|
||||||
if params.post_id.is_some() || params.comment_id.is_some() {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
|
||||||
|
|
||||||
query
|
|
||||||
.limit(limit)
|
|
||||||
.offset(offset)
|
|
||||||
.order_by(mod_transfer_community::when_.desc())
|
|
||||||
.load::<ModTransferCommunityView>(conn)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
1388
crates/db_views_moderator/src/modlog_combined_view.rs
Normal file
1388
crates/db_views_moderator/src/modlog_combined_view.rs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,37 +1,34 @@
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use diesel::Queryable;
|
use diesel::Queryable;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::source::{
|
||||||
newtypes::{CommentId, CommunityId, PersonId, PostId},
|
comment::Comment,
|
||||||
source::{
|
community::Community,
|
||||||
comment::Comment,
|
instance::Instance,
|
||||||
community::Community,
|
mod_log::{
|
||||||
instance::Instance,
|
admin::{
|
||||||
mod_log::{
|
AdminAllowInstance,
|
||||||
admin::{
|
AdminBlockInstance,
|
||||||
AdminAllowInstance,
|
AdminPurgeComment,
|
||||||
AdminBlockInstance,
|
AdminPurgeCommunity,
|
||||||
AdminPurgeComment,
|
AdminPurgePerson,
|
||||||
AdminPurgeCommunity,
|
AdminPurgePost,
|
||||||
AdminPurgePerson,
|
},
|
||||||
AdminPurgePost,
|
moderator::{
|
||||||
},
|
ModAdd,
|
||||||
moderator::{
|
ModAddCommunity,
|
||||||
ModAdd,
|
ModBan,
|
||||||
ModAddCommunity,
|
ModBanFromCommunity,
|
||||||
ModBan,
|
ModFeaturePost,
|
||||||
ModBanFromCommunity,
|
ModHideCommunity,
|
||||||
ModFeaturePost,
|
ModLockPost,
|
||||||
ModHideCommunity,
|
ModRemoveComment,
|
||||||
ModLockPost,
|
ModRemoveCommunity,
|
||||||
ModRemoveComment,
|
ModRemovePost,
|
||||||
ModRemoveCommunity,
|
ModTransferCommunity,
|
||||||
ModRemovePost,
|
|
||||||
ModTransferCommunity,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
person::Person,
|
|
||||||
post::Post,
|
|
||||||
},
|
},
|
||||||
|
person::Person,
|
||||||
|
post::Post,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
|
@ -39,7 +36,7 @@ use serde_with::skip_serializing_none;
|
||||||
use ts_rs::TS;
|
use ts_rs::TS;
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -49,11 +46,11 @@ pub struct ModAddCommunityView {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub modded_person: Person,
|
pub other_person: Person,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -62,11 +59,11 @@ pub struct ModAddView {
|
||||||
pub mod_add: ModAdd,
|
pub mod_add: ModAdd,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub modded_person: Person,
|
pub other_person: Person,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -76,11 +73,11 @@ pub struct ModBanFromCommunityView {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub banned_person: Person,
|
pub other_person: Person,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -89,11 +86,11 @@ pub struct ModBanView {
|
||||||
pub mod_ban: ModBan,
|
pub mod_ban: ModBan,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub banned_person: Person,
|
pub other_person: Person,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -106,7 +103,7 @@ pub struct ModHideCommunityView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -115,12 +112,13 @@ pub struct ModLockPostView {
|
||||||
pub mod_lock_post: ModLockPost,
|
pub mod_lock_post: ModLockPost,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
|
pub other_person: Person,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -129,14 +127,14 @@ pub struct ModRemoveCommentView {
|
||||||
pub mod_remove_comment: ModRemoveComment,
|
pub mod_remove_comment: ModRemoveComment,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
|
pub other_person: Person,
|
||||||
pub comment: Comment,
|
pub comment: Comment,
|
||||||
pub commenter: Person,
|
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -149,7 +147,7 @@ pub struct ModRemoveCommunityView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -158,12 +156,13 @@ pub struct ModRemovePostView {
|
||||||
pub mod_remove_post: ModRemovePost,
|
pub mod_remove_post: ModRemovePost,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
|
pub other_person: Person,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -172,12 +171,13 @@ pub struct ModFeaturePostView {
|
||||||
pub mod_feature_post: ModFeaturePost,
|
pub mod_feature_post: ModFeaturePost,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
|
pub other_person: Person,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -187,11 +187,11 @@ pub struct ModTransferCommunityView {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub modded_person: Person,
|
pub other_person: Person,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -204,7 +204,7 @@ pub struct AdminPurgeCommentView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -216,7 +216,7 @@ pub struct AdminPurgeCommunityView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -228,7 +228,7 @@ pub struct AdminPurgePersonView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -241,7 +241,7 @@ pub struct AdminPurgePostView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
@ -254,38 +254,79 @@ pub struct AdminBlockInstanceView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// When an admin purges a post.
|
/// When an admin purges a post.
|
||||||
pub struct AdminAllowInstanceView {
|
pub struct AdminAllowInstanceView {
|
||||||
pub admin_block_instance: AdminAllowInstance,
|
pub admin_allow_instance: AdminAllowInstance,
|
||||||
pub instance: Instance,
|
pub instance: Instance,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
/// like PaginationCursor but for the modlog_combined
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Querying / filtering the modlog.
|
pub struct ModlogCombinedPaginationCursor(pub String);
|
||||||
pub struct ModlogListParams {
|
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
pub community_id: Option<CommunityId>,
|
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
pub mod_person_id: Option<PersonId>,
|
/// A combined modlog view
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
pub struct ModlogCombinedViewInternal {
|
||||||
pub other_person_id: Option<PersonId>,
|
// Specific
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
pub admin_allow_instance: Option<AdminAllowInstance>,
|
||||||
pub post_id: Option<PostId>,
|
pub admin_block_instance: Option<AdminBlockInstance>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
pub admin_purge_comment: Option<AdminPurgeComment>,
|
||||||
pub comment_id: Option<CommentId>,
|
pub admin_purge_community: Option<AdminPurgeCommunity>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
pub admin_purge_person: Option<AdminPurgePerson>,
|
||||||
pub page: Option<i64>,
|
pub admin_purge_post: Option<AdminPurgePost>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
pub mod_add: Option<ModAdd>,
|
||||||
pub limit: Option<i64>,
|
pub mod_add_community: Option<ModAddCommunity>,
|
||||||
pub hide_modlog_names: bool,
|
pub mod_ban: Option<ModBan>,
|
||||||
|
pub mod_ban_from_community: Option<ModBanFromCommunity>,
|
||||||
|
pub mod_feature_post: Option<ModFeaturePost>,
|
||||||
|
pub mod_hide_community: Option<ModHideCommunity>,
|
||||||
|
pub mod_lock_post: Option<ModLockPost>,
|
||||||
|
pub mod_remove_comment: Option<ModRemoveComment>,
|
||||||
|
pub mod_remove_community: Option<ModRemoveCommunity>,
|
||||||
|
pub mod_remove_post: Option<ModRemovePost>,
|
||||||
|
pub mod_transfer_community: Option<ModTransferCommunity>,
|
||||||
|
// Specific fields
|
||||||
|
|
||||||
|
// Shared
|
||||||
|
pub moderator: Option<Person>,
|
||||||
|
pub other_person: Option<Person>,
|
||||||
|
pub instance: Option<Instance>,
|
||||||
|
pub community: Option<Community>,
|
||||||
|
pub post: Option<Post>,
|
||||||
|
pub comment: Option<Comment>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
// Use serde's internal tagging, to work easier with javascript libraries
|
||||||
|
#[serde(tag = "type_")]
|
||||||
|
pub enum ModlogCombinedView {
|
||||||
|
AdminAllowInstance(AdminAllowInstanceView),
|
||||||
|
AdminBlockInstance(AdminBlockInstanceView),
|
||||||
|
AdminPurgeComment(AdminPurgeCommentView),
|
||||||
|
AdminPurgeCommunity(AdminPurgeCommunityView),
|
||||||
|
AdminPurgePerson(AdminPurgePersonView),
|
||||||
|
AdminPurgePost(AdminPurgePostView),
|
||||||
|
ModAdd(ModAddView),
|
||||||
|
ModAddCommunity(ModAddCommunityView),
|
||||||
|
ModBan(ModBanView),
|
||||||
|
ModBanFromCommunity(ModBanFromCommunityView),
|
||||||
|
ModFeaturePost(ModFeaturePostView),
|
||||||
|
ModHideCommunity(ModHideCommunityView),
|
||||||
|
ModLockPost(ModLockPostView),
|
||||||
|
ModRemoveComment(ModRemoveCommentView),
|
||||||
|
ModRemoveCommunity(ModRemoveCommunityView),
|
||||||
|
ModRemovePost(ModRemovePostView),
|
||||||
|
ModTransferCommunity(ModTransferCommunityView),
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
DROP TABLE modlog_combined;
|
||||||
|
|
||||||
|
-- Rename the columns back to when_
|
||||||
|
ALTER TABLE admin_allow_instance RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE admin_block_instance RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE admin_purge_comment RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE admin_purge_community RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE admin_purge_person RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE admin_purge_post RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_add RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_add_community RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_ban RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_ban_from_community RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_feature_post RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_hide_community RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_lock_post RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_remove_comment RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_remove_community RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_remove_post RENAME COLUMN published TO when_;
|
||||||
|
|
||||||
|
ALTER TABLE mod_transfer_community RENAME COLUMN published TO when_;
|
||||||
|
|
201
migrations/2024-12-08-165614_add_modlog_combined_table/up.sql
Normal file
201
migrations/2024-12-08-165614_add_modlog_combined_table/up.sql
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
-- First, rename all the when_ columns on the modlog to published
|
||||||
|
ALTER TABLE admin_allow_instance RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE admin_block_instance RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE admin_purge_comment RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE admin_purge_community RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE admin_purge_person RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE admin_purge_post RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_add RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_add_community RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_ban RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_ban_from_community RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_feature_post RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_hide_community RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_lock_post RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_remove_comment RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_remove_community RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_remove_post RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
ALTER TABLE mod_transfer_community RENAME COLUMN when_ TO published;
|
||||||
|
|
||||||
|
-- Creates combined tables for
|
||||||
|
-- modlog: (17 tables)
|
||||||
|
-- admin_allow_instance
|
||||||
|
-- admin_block_instance
|
||||||
|
-- admin_purge_comment
|
||||||
|
-- admin_purge_community
|
||||||
|
-- admin_purge_person
|
||||||
|
-- admin_purge_post
|
||||||
|
-- mod_add
|
||||||
|
-- mod_add_community
|
||||||
|
-- mod_ban
|
||||||
|
-- mod_ban_from_community
|
||||||
|
-- mod_feature_post
|
||||||
|
-- mod_hide_community
|
||||||
|
-- mod_lock_post
|
||||||
|
-- mod_remove_comment
|
||||||
|
-- mod_remove_community
|
||||||
|
-- mod_remove_post
|
||||||
|
-- mod_transfer_community
|
||||||
|
CREATE TABLE modlog_combined (
|
||||||
|
id serial PRIMARY KEY,
|
||||||
|
published timestamptz NOT NULL,
|
||||||
|
admin_allow_instance_id int UNIQUE REFERENCES admin_allow_instance ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
admin_block_instance_id int UNIQUE REFERENCES admin_block_instance ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
admin_purge_comment_id int UNIQUE REFERENCES admin_purge_comment ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
admin_purge_community_id int UNIQUE REFERENCES admin_purge_community ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
admin_purge_person_id int UNIQUE REFERENCES admin_purge_person ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
admin_purge_post_id int UNIQUE REFERENCES admin_purge_post ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_add_id int UNIQUE REFERENCES mod_add ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_add_community_id int UNIQUE REFERENCES mod_add_community ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_ban_id int UNIQUE REFERENCES mod_ban ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_ban_from_community_id int UNIQUE REFERENCES mod_ban_from_community ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_feature_post_id int UNIQUE REFERENCES mod_feature_post ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_hide_community_id int UNIQUE REFERENCES mod_hide_community ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_lock_post_id int UNIQUE REFERENCES mod_lock_post ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_remove_comment_id int UNIQUE REFERENCES mod_remove_comment ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_remove_community_id int UNIQUE REFERENCES mod_remove_community ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_remove_post_id int UNIQUE REFERENCES mod_remove_post ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
mod_transfer_community_id int UNIQUE REFERENCES mod_transfer_community ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
-- Make sure only one of the columns is not null
|
||||||
|
CHECK (num_nonnulls (admin_allow_instance_id, admin_block_instance_id, admin_purge_comment_id, admin_purge_community_id, admin_purge_person_id, admin_purge_post_id, mod_add_id, mod_add_community_id, mod_ban_id, mod_ban_from_community_id, mod_feature_post_id, mod_hide_community_id, mod_lock_post_id, mod_remove_comment_id, mod_remove_community_id, mod_remove_post_id, mod_transfer_community_id) = 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX idx_modlog_combined_published ON modlog_combined (published DESC, id DESC);
|
||||||
|
|
||||||
|
-- Updating the history
|
||||||
|
-- Not doing a union all here, because there's way too many null columns
|
||||||
|
INSERT INTO modlog_combined (published, admin_allow_instance_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
admin_allow_instance;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, admin_block_instance_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
admin_block_instance;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, admin_purge_comment_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
admin_purge_comment;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, admin_purge_community_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
admin_purge_community;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, admin_purge_person_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
admin_purge_person;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, admin_purge_post_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
admin_purge_post;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_add_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_add;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_add_community_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_add_community;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_ban_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_ban;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_ban_from_community_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_ban_from_community;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_feature_post_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_feature_post;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_hide_community_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_hide_community;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_lock_post_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_lock_post;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_remove_comment_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_remove_comment;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_remove_community_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_remove_community;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_remove_post_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_remove_post;
|
||||||
|
|
||||||
|
INSERT INTO modlog_combined (published, mod_transfer_community_id)
|
||||||
|
SELECT
|
||||||
|
published,
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
mod_transfer_community;
|
||||||
|
|
Loading…
Reference in a new issue