mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-22 19:01:32 +00:00
Change "mark post as read", "hide post" api calls to take single post instead of multiple (#5043)
* Removing a few SuccessResponses for PostHide and MarkPostAsRead. - This also removes the pointless multiple post_ids. These can be done as individual calls on the front end anyway. - Fixes #4755 * Fixing federation tests. * Upgrading lemmy-js-client deps. * Simplifying forms. * Fixing forms. * Removing indexing slicing from a test.
This commit is contained in:
parent
faf62de4e3
commit
c4d864878f
9 changed files with 215 additions and 208 deletions
|
@ -22,16 +22,16 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/node": "^22.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.1.0",
|
||||
"@typescript-eslint/parser": "^8.1.0",
|
||||
"eslint": "^9.9.0",
|
||||
"@types/node": "^22.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
||||
"@typescript-eslint/parser": "^8.13.0",
|
||||
"eslint": "^9.14.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"jest": "^29.5.0",
|
||||
"lemmy-js-client": "0.20.0-private-community.9",
|
||||
"lemmy-js-client": "0.20.0-alpha.18",
|
||||
"prettier": "^3.2.5",
|
||||
"ts-jest": "^29.1.0",
|
||||
"typescript": "^5.5.4",
|
||||
"typescript-eslint": "^8.1.0"
|
||||
"typescript-eslint": "^8.13.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,38 +12,38 @@ importers:
|
|||
specifier: ^29.5.12
|
||||
version: 29.5.14
|
||||
'@types/node':
|
||||
specifier: ^22.3.0
|
||||
version: 22.8.6
|
||||
specifier: ^22.9.0
|
||||
version: 22.9.0
|
||||
'@typescript-eslint/eslint-plugin':
|
||||
specifier: ^8.1.0
|
||||
version: 8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3)
|
||||
specifier: ^8.13.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)
|
||||
'@typescript-eslint/parser':
|
||||
specifier: ^8.1.0
|
||||
version: 8.12.2(eslint@9.13.0)(typescript@5.6.3)
|
||||
specifier: ^8.13.0
|
||||
version: 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
||||
eslint:
|
||||
specifier: ^9.9.0
|
||||
version: 9.13.0
|
||||
specifier: ^9.14.0
|
||||
version: 9.14.0
|
||||
eslint-plugin-prettier:
|
||||
specifier: ^5.1.3
|
||||
version: 5.2.1(eslint@9.13.0)(prettier@3.3.3)
|
||||
version: 5.2.1(eslint@9.14.0)(prettier@3.3.3)
|
||||
jest:
|
||||
specifier: ^29.5.0
|
||||
version: 29.7.0(@types/node@22.8.6)
|
||||
version: 29.7.0(@types/node@22.9.0)
|
||||
lemmy-js-client:
|
||||
specifier: 0.20.0-private-community.9
|
||||
version: 0.20.0-private-community.9
|
||||
specifier: 0.20.0-alpha.18
|
||||
version: 0.20.0-alpha.18
|
||||
prettier:
|
||||
specifier: ^3.2.5
|
||||
version: 3.3.3
|
||||
ts-jest:
|
||||
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.8.6))(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.9.0))(typescript@5.6.3)
|
||||
typescript:
|
||||
specifier: ^5.5.4
|
||||
version: 5.6.3
|
||||
typescript-eslint:
|
||||
specifier: ^8.1.0
|
||||
version: 8.12.2(eslint@9.13.0)(typescript@5.6.3)
|
||||
specifier: ^8.13.0
|
||||
version: 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
||||
|
||||
packages:
|
||||
|
||||
|
@ -240,8 +240,8 @@ packages:
|
|||
resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@eslint/js@9.13.0':
|
||||
resolution: {integrity: sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA==}
|
||||
'@eslint/js@9.14.0':
|
||||
resolution: {integrity: sha512-pFoEtFWCPyDOl+C6Ift+wC7Ro89otjigCf5vcuWqWgqNSQbRrpjSvdeE6ofLz4dHmyxD5f7gIdGT4+p36L6Twg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@eslint/object-schema@2.1.4':
|
||||
|
@ -268,6 +268,10 @@ packages:
|
|||
resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==}
|
||||
engines: {node: '>=18.18'}
|
||||
|
||||
'@humanwhocodes/retry@0.4.1':
|
||||
resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==}
|
||||
engines: {node: '>=18.18'}
|
||||
|
||||
'@istanbuljs/load-nyc-config@1.1.0':
|
||||
resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
@ -418,8 +422,8 @@ packages:
|
|||
'@types/json-schema@7.0.15':
|
||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||
|
||||
'@types/node@22.8.6':
|
||||
resolution: {integrity: sha512-tosuJYKrIqjQIlVCM4PEGxOmyg3FCPa/fViuJChnGeEIhjA46oy8FMVoF9su1/v8PNs2a8Q0iFNyOx0uOF91nw==}
|
||||
'@types/node@22.9.0':
|
||||
resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==}
|
||||
|
||||
'@types/stack-utils@2.0.3':
|
||||
resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==}
|
||||
|
@ -430,8 +434,8 @@ packages:
|
|||
'@types/yargs@17.0.32':
|
||||
resolution: {integrity: sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==}
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.12.2':
|
||||
resolution: {integrity: sha512-gQxbxM8mcxBwaEmWdtLCIGLfixBMHhQjBqR8sVWNTPpcj45WlYL2IObS/DNMLH1DBP0n8qz+aiiLTGfopPEebw==}
|
||||
'@typescript-eslint/eslint-plugin@8.13.0':
|
||||
resolution: {integrity: sha512-nQtBLiZYMUPkclSeC3id+x4uVd1SGtHuElTxL++SfP47jR0zfkZBJHc+gL4qPsgTuypz0k8Y2GheaDYn6Gy3rg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0
|
||||
|
@ -441,8 +445,8 @@ packages:
|
|||
typescript:
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/parser@8.12.2':
|
||||
resolution: {integrity: sha512-MrvlXNfGPLH3Z+r7Tk+Z5moZAc0dzdVjTgUgwsdGweH7lydysQsnSww3nAmsq8blFuRD5VRlAr9YdEFw3e6PBw==}
|
||||
'@typescript-eslint/parser@8.13.0':
|
||||
resolution: {integrity: sha512-w0xp+xGg8u/nONcGw1UXAr6cjCPU1w0XVyBs6Zqaj5eLmxkKQAByTdV/uGgNN5tVvN/kKpoQlP2cL7R+ajZZIQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0
|
||||
|
@ -451,12 +455,12 @@ packages:
|
|||
typescript:
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/scope-manager@8.12.2':
|
||||
resolution: {integrity: sha512-gPLpLtrj9aMHOvxJkSbDBmbRuYdtiEbnvO25bCMza3DhMjTQw0u7Y1M+YR5JPbMsXXnSPuCf5hfq0nEkQDL/JQ==}
|
||||
'@typescript-eslint/scope-manager@8.13.0':
|
||||
resolution: {integrity: sha512-XsGWww0odcUT0gJoBZ1DeulY1+jkaHUciUq4jKNv4cpInbvvrtDoyBH9rE/n2V29wQJPk8iCH1wipra9BhmiMA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/type-utils@8.12.2':
|
||||
resolution: {integrity: sha512-bwuU4TAogPI+1q/IJSKuD4shBLc/d2vGcRT588q+jzayQyjVK2X6v/fbR4InY2U2sgf8MEvVCqEWUzYzgBNcGQ==}
|
||||
'@typescript-eslint/type-utils@8.13.0':
|
||||
resolution: {integrity: sha512-Rqnn6xXTR316fP4D2pohZenJnp+NwQ1mo7/JM+J1LWZENSLkJI8ID8QNtlvFeb0HnFSK94D6q0cnMX6SbE5/vA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
|
@ -464,12 +468,12 @@ packages:
|
|||
typescript:
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/types@8.12.2':
|
||||
resolution: {integrity: sha512-VwDwMF1SZ7wPBUZwmMdnDJ6sIFk4K4s+ALKLP6aIQsISkPv8jhiw65sAK6SuWODN/ix+m+HgbYDkH+zLjrzvOA==}
|
||||
'@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.12.2':
|
||||
resolution: {integrity: sha512-mME5MDwGe30Pq9zKPvyduyU86PH7aixwqYR2grTglAdB+AN8xXQ1vFGpYaUSJ5o5P/5znsSBeNcs5g5/2aQwow==}
|
||||
'@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: '*'
|
||||
|
@ -477,14 +481,14 @@ packages:
|
|||
typescript:
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/utils@8.12.2':
|
||||
resolution: {integrity: sha512-UTTuDIX3fkfAz6iSVa5rTuSfWIYZ6ATtEocQ/umkRSyC9O919lbZ8dcH7mysshrCdrAM03skJOEYaBugxN+M6A==}
|
||||
'@typescript-eslint/utils@8.13.0':
|
||||
resolution: {integrity: sha512-A1EeYOND6Uv250nybnLZapeXpYMl8tkzYUxqmoKAWnI4sei3ihf2XdZVd+vVOmHGcp3t+P7yRrNsyyiXTvShFQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.12.2':
|
||||
resolution: {integrity: sha512-PChz8UaKQAVNHghsHcPyx1OMHoFRUEA7rJSK/mDhdq85bk+PLsUHUBqTQTFt18VJZbmxBovM65fezlheQRsSDA==}
|
||||
'@typescript-eslint/visitor-keys@8.13.0':
|
||||
resolution: {integrity: sha512-7N/+lztJqH4Mrf0lb10R/CbI1EaAMMGyF5y0oJvFoAhafwgiRA7TXyd8TFn8FC8k5y2dTsYogg238qavRGNnlw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
acorn-jsx@5.3.2:
|
||||
|
@ -649,6 +653,10 @@ packages:
|
|||
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
cross-spawn@7.0.5:
|
||||
resolution: {integrity: sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
debug@4.3.7:
|
||||
resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==}
|
||||
engines: {node: '>=6.0'}
|
||||
|
@ -737,8 +745,8 @@ packages:
|
|||
resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
eslint@9.13.0:
|
||||
resolution: {integrity: sha512-EYZK6SX6zjFHST/HRytOdA/zE72Cq/bfw45LSyuwrdvcclb/gqV8RRQxywOBEWO2+WDpva6UZa4CcDeJKzUCFA==}
|
||||
eslint@9.14.0:
|
||||
resolution: {integrity: sha512-c2FHsVBr87lnUtjP4Yhvk4yEhKrQavGafRA/Se1ouse8PfbfC/Qh9Mxa00yWsZRlqeUB9raXip0aiiUZkgnr9g==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
|
@ -1159,8 +1167,8 @@ packages:
|
|||
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
lemmy-js-client@0.20.0-private-community.9:
|
||||
resolution: {integrity: sha512-iuFezswCzIco5U5Q4Eo8HAWVE65pDW2zeO+fYLEyFl30SLw9a3gqJkip2vbDfVvoAjDXyUskZKddf1Nnj8mVcg==}
|
||||
lemmy-js-client@0.20.0-alpha.18:
|
||||
resolution: {integrity: sha512-oZy8DboTWfUar4mPWpi7SYrOEjTBJxkvd1e6QaVwoA5UhqQV1WhxEYbzrpi/gXnEokaVQ0i5sjtL/Y2PHMO3MQ==}
|
||||
|
||||
leven@3.1.0:
|
||||
resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
|
||||
|
@ -1533,8 +1541,8 @@ packages:
|
|||
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
typescript-eslint@8.12.2:
|
||||
resolution: {integrity: sha512-UbuVUWSrHVR03q9CWx+JDHeO6B/Hr9p4U5lRH++5tq/EbFq1faYZe50ZSBePptgfIKLEti0aPQ3hFgnPVcd8ZQ==}
|
||||
typescript-eslint@8.13.0:
|
||||
resolution: {integrity: sha512-vIMpDRJrQd70au2G8w34mPps0ezFSPMEX4pXkTzUkrNbRX+36ais2ksGWN0esZL+ZMaFJEneOBHzCgSqle7DHw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
|
@ -1808,9 +1816,9 @@ snapshots:
|
|||
|
||||
'@bcoe/v8-coverage@0.2.3': {}
|
||||
|
||||
'@eslint-community/eslint-utils@4.4.1(eslint@9.13.0)':
|
||||
'@eslint-community/eslint-utils@4.4.1(eslint@9.14.0)':
|
||||
dependencies:
|
||||
eslint: 9.13.0
|
||||
eslint: 9.14.0
|
||||
eslint-visitor-keys: 3.4.3
|
||||
|
||||
'@eslint-community/regexpp@4.12.1': {}
|
||||
|
@ -1839,7 +1847,7 @@ snapshots:
|
|||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@eslint/js@9.13.0': {}
|
||||
'@eslint/js@9.14.0': {}
|
||||
|
||||
'@eslint/object-schema@2.1.4': {}
|
||||
|
||||
|
@ -1858,6 +1866,8 @@ snapshots:
|
|||
|
||||
'@humanwhocodes/retry@0.3.1': {}
|
||||
|
||||
'@humanwhocodes/retry@0.4.1': {}
|
||||
|
||||
'@istanbuljs/load-nyc-config@1.1.0':
|
||||
dependencies:
|
||||
camelcase: 5.3.1
|
||||
|
@ -1871,7 +1881,7 @@ snapshots:
|
|||
'@jest/console@29.7.0':
|
||||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
chalk: 4.1.2
|
||||
jest-message-util: 29.7.0
|
||||
jest-util: 29.7.0
|
||||
|
@ -1884,14 +1894,14 @@ snapshots:
|
|||
'@jest/test-result': 29.7.0
|
||||
'@jest/transform': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.9.0
|
||||
exit: 0.1.2
|
||||
graceful-fs: 4.2.11
|
||||
jest-changed-files: 29.7.0
|
||||
jest-config: 29.7.0(@types/node@22.8.6)
|
||||
jest-config: 29.7.0(@types/node@22.9.0)
|
||||
jest-haste-map: 29.7.0
|
||||
jest-message-util: 29.7.0
|
||||
jest-regex-util: 29.6.3
|
||||
|
@ -1916,7 +1926,7 @@ snapshots:
|
|||
dependencies:
|
||||
'@jest/fake-timers': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
jest-mock: 29.7.0
|
||||
|
||||
'@jest/expect-utils@29.7.0':
|
||||
|
@ -1934,7 +1944,7 @@ snapshots:
|
|||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
'@sinonjs/fake-timers': 10.3.0
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
jest-message-util: 29.7.0
|
||||
jest-mock: 29.7.0
|
||||
jest-util: 29.7.0
|
||||
|
@ -1956,7 +1966,7 @@ snapshots:
|
|||
'@jest/transform': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@jridgewell/trace-mapping': 0.3.22
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
chalk: 4.1.2
|
||||
collect-v8-coverage: 1.0.2
|
||||
exit: 0.1.2
|
||||
|
@ -2026,7 +2036,7 @@ snapshots:
|
|||
'@jest/schemas': 29.6.3
|
||||
'@types/istanbul-lib-coverage': 2.0.6
|
||||
'@types/istanbul-reports': 3.0.4
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
'@types/yargs': 17.0.32
|
||||
chalk: 4.1.2
|
||||
|
||||
|
@ -2096,7 +2106,7 @@ snapshots:
|
|||
|
||||
'@types/graceful-fs@4.1.9':
|
||||
dependencies:
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
|
||||
'@types/istanbul-lib-coverage@2.0.6': {}
|
||||
|
||||
|
@ -2115,7 +2125,7 @@ snapshots:
|
|||
|
||||
'@types/json-schema@7.0.15': {}
|
||||
|
||||
'@types/node@22.8.6':
|
||||
'@types/node@22.9.0':
|
||||
dependencies:
|
||||
undici-types: 6.19.8
|
||||
|
||||
|
@ -2127,15 +2137,15 @@ snapshots:
|
|||
dependencies:
|
||||
'@types/yargs-parser': 21.0.3
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.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)':
|
||||
dependencies:
|
||||
'@eslint-community/regexpp': 4.12.1
|
||||
'@typescript-eslint/parser': 8.12.2(eslint@9.13.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/scope-manager': 8.12.2
|
||||
'@typescript-eslint/type-utils': 8.12.2(eslint@9.13.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/utils': 8.12.2(eslint@9.13.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/visitor-keys': 8.12.2
|
||||
eslint: 9.13.0
|
||||
'@typescript-eslint/parser': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/scope-manager': 8.13.0
|
||||
'@typescript-eslint/type-utils': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/utils': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/visitor-keys': 8.13.0
|
||||
eslint: 9.14.0
|
||||
graphemer: 1.4.0
|
||||
ignore: 5.3.2
|
||||
natural-compare: 1.4.0
|
||||
|
@ -2145,28 +2155,28 @@ snapshots:
|
|||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3)':
|
||||
'@typescript-eslint/parser@8.13.0(eslint@9.14.0)(typescript@5.6.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/scope-manager': 8.12.2
|
||||
'@typescript-eslint/types': 8.12.2
|
||||
'@typescript-eslint/typescript-estree': 8.12.2(typescript@5.6.3)
|
||||
'@typescript-eslint/visitor-keys': 8.12.2
|
||||
'@typescript-eslint/scope-manager': 8.13.0
|
||||
'@typescript-eslint/types': 8.13.0
|
||||
'@typescript-eslint/typescript-estree': 8.13.0(typescript@5.6.3)
|
||||
'@typescript-eslint/visitor-keys': 8.13.0
|
||||
debug: 4.3.7
|
||||
eslint: 9.13.0
|
||||
eslint: 9.14.0
|
||||
optionalDependencies:
|
||||
typescript: 5.6.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/scope-manager@8.12.2':
|
||||
'@typescript-eslint/scope-manager@8.13.0':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.12.2
|
||||
'@typescript-eslint/visitor-keys': 8.12.2
|
||||
'@typescript-eslint/types': 8.13.0
|
||||
'@typescript-eslint/visitor-keys': 8.13.0
|
||||
|
||||
'@typescript-eslint/type-utils@8.12.2(eslint@9.13.0)(typescript@5.6.3)':
|
||||
'@typescript-eslint/type-utils@8.13.0(eslint@9.14.0)(typescript@5.6.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/typescript-estree': 8.12.2(typescript@5.6.3)
|
||||
'@typescript-eslint/utils': 8.12.2(eslint@9.13.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/typescript-estree': 8.13.0(typescript@5.6.3)
|
||||
'@typescript-eslint/utils': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
||||
debug: 4.3.7
|
||||
ts-api-utils: 1.4.0(typescript@5.6.3)
|
||||
optionalDependencies:
|
||||
|
@ -2175,12 +2185,12 @@ snapshots:
|
|||
- eslint
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/types@8.12.2': {}
|
||||
'@typescript-eslint/types@8.13.0': {}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.12.2(typescript@5.6.3)':
|
||||
'@typescript-eslint/typescript-estree@8.13.0(typescript@5.6.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.12.2
|
||||
'@typescript-eslint/visitor-keys': 8.12.2
|
||||
'@typescript-eslint/types': 8.13.0
|
||||
'@typescript-eslint/visitor-keys': 8.13.0
|
||||
debug: 4.3.7
|
||||
fast-glob: 3.3.2
|
||||
is-glob: 4.0.3
|
||||
|
@ -2192,20 +2202,20 @@ snapshots:
|
|||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@8.12.2(eslint@9.13.0)(typescript@5.6.3)':
|
||||
'@typescript-eslint/utils@8.13.0(eslint@9.14.0)(typescript@5.6.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.13.0)
|
||||
'@typescript-eslint/scope-manager': 8.12.2
|
||||
'@typescript-eslint/types': 8.12.2
|
||||
'@typescript-eslint/typescript-estree': 8.12.2(typescript@5.6.3)
|
||||
eslint: 9.13.0
|
||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.14.0)
|
||||
'@typescript-eslint/scope-manager': 8.13.0
|
||||
'@typescript-eslint/types': 8.13.0
|
||||
'@typescript-eslint/typescript-estree': 8.13.0(typescript@5.6.3)
|
||||
eslint: 9.14.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
- typescript
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.12.2':
|
||||
'@typescript-eslint/visitor-keys@8.13.0':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.12.2
|
||||
'@typescript-eslint/types': 8.13.0
|
||||
eslint-visitor-keys: 3.4.3
|
||||
|
||||
acorn-jsx@5.3.2(acorn@8.14.0):
|
||||
|
@ -2373,13 +2383,13 @@ snapshots:
|
|||
|
||||
convert-source-map@2.0.0: {}
|
||||
|
||||
create-jest@29.7.0(@types/node@22.8.6):
|
||||
create-jest@29.7.0(@types/node@22.9.0):
|
||||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
chalk: 4.1.2
|
||||
exit: 0.1.2
|
||||
graceful-fs: 4.2.11
|
||||
jest-config: 29.7.0(@types/node@22.8.6)
|
||||
jest-config: 29.7.0(@types/node@22.9.0)
|
||||
jest-util: 29.7.0
|
||||
prompts: 2.4.2
|
||||
transitivePeerDependencies:
|
||||
|
@ -2394,6 +2404,12 @@ snapshots:
|
|||
shebang-command: 2.0.0
|
||||
which: 2.0.2
|
||||
|
||||
cross-spawn@7.0.5:
|
||||
dependencies:
|
||||
path-key: 3.1.1
|
||||
shebang-command: 2.0.0
|
||||
which: 2.0.2
|
||||
|
||||
debug@4.3.7:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
@ -2428,9 +2444,9 @@ snapshots:
|
|||
|
||||
escape-string-regexp@4.0.0: {}
|
||||
|
||||
eslint-plugin-prettier@5.2.1(eslint@9.13.0)(prettier@3.3.3):
|
||||
eslint-plugin-prettier@5.2.1(eslint@9.14.0)(prettier@3.3.3):
|
||||
dependencies:
|
||||
eslint: 9.13.0
|
||||
eslint: 9.14.0
|
||||
prettier: 3.3.3
|
||||
prettier-linter-helpers: 1.0.0
|
||||
synckit: 0.9.1
|
||||
|
@ -2444,23 +2460,23 @@ snapshots:
|
|||
|
||||
eslint-visitor-keys@4.2.0: {}
|
||||
|
||||
eslint@9.13.0:
|
||||
eslint@9.14.0:
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.13.0)
|
||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.14.0)
|
||||
'@eslint-community/regexpp': 4.12.1
|
||||
'@eslint/config-array': 0.18.0
|
||||
'@eslint/core': 0.7.0
|
||||
'@eslint/eslintrc': 3.1.0
|
||||
'@eslint/js': 9.13.0
|
||||
'@eslint/js': 9.14.0
|
||||
'@eslint/plugin-kit': 0.2.2
|
||||
'@humanfs/node': 0.16.6
|
||||
'@humanwhocodes/module-importer': 1.0.1
|
||||
'@humanwhocodes/retry': 0.3.1
|
||||
'@humanwhocodes/retry': 0.4.1
|
||||
'@types/estree': 1.0.6
|
||||
'@types/json-schema': 7.0.15
|
||||
ajv: 6.12.6
|
||||
chalk: 4.1.2
|
||||
cross-spawn: 7.0.3
|
||||
cross-spawn: 7.0.5
|
||||
debug: 4.3.7
|
||||
escape-string-regexp: 4.0.0
|
||||
eslint-scope: 8.2.0
|
||||
|
@ -2736,7 +2752,7 @@ snapshots:
|
|||
'@jest/expect': 29.7.0
|
||||
'@jest/test-result': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
chalk: 4.1.2
|
||||
co: 4.6.0
|
||||
dedent: 1.5.1
|
||||
|
@ -2756,16 +2772,16 @@ snapshots:
|
|||
- babel-plugin-macros
|
||||
- supports-color
|
||||
|
||||
jest-cli@29.7.0(@types/node@22.8.6):
|
||||
jest-cli@29.7.0(@types/node@22.9.0):
|
||||
dependencies:
|
||||
'@jest/core': 29.7.0
|
||||
'@jest/test-result': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
chalk: 4.1.2
|
||||
create-jest: 29.7.0(@types/node@22.8.6)
|
||||
create-jest: 29.7.0(@types/node@22.9.0)
|
||||
exit: 0.1.2
|
||||
import-local: 3.1.0
|
||||
jest-config: 29.7.0(@types/node@22.8.6)
|
||||
jest-config: 29.7.0(@types/node@22.9.0)
|
||||
jest-util: 29.7.0
|
||||
jest-validate: 29.7.0
|
||||
yargs: 17.7.2
|
||||
|
@ -2775,7 +2791,7 @@ snapshots:
|
|||
- supports-color
|
||||
- ts-node
|
||||
|
||||
jest-config@29.7.0(@types/node@22.8.6):
|
||||
jest-config@29.7.0(@types/node@22.9.0):
|
||||
dependencies:
|
||||
'@babel/core': 7.23.9
|
||||
'@jest/test-sequencer': 29.7.0
|
||||
|
@ -2800,7 +2816,7 @@ snapshots:
|
|||
slash: 3.0.0
|
||||
strip-json-comments: 3.1.1
|
||||
optionalDependencies:
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
transitivePeerDependencies:
|
||||
- babel-plugin-macros
|
||||
- supports-color
|
||||
|
@ -2829,7 +2845,7 @@ snapshots:
|
|||
'@jest/environment': 29.7.0
|
||||
'@jest/fake-timers': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
jest-mock: 29.7.0
|
||||
jest-util: 29.7.0
|
||||
|
||||
|
@ -2839,7 +2855,7 @@ snapshots:
|
|||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
'@types/graceful-fs': 4.1.9
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
anymatch: 3.1.3
|
||||
fb-watchman: 2.0.2
|
||||
graceful-fs: 4.2.11
|
||||
|
@ -2878,7 +2894,7 @@ snapshots:
|
|||
jest-mock@29.7.0:
|
||||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
jest-util: 29.7.0
|
||||
|
||||
jest-pnp-resolver@1.2.3(jest-resolve@29.7.0):
|
||||
|
@ -2913,7 +2929,7 @@ snapshots:
|
|||
'@jest/test-result': 29.7.0
|
||||
'@jest/transform': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
chalk: 4.1.2
|
||||
emittery: 0.13.1
|
||||
graceful-fs: 4.2.11
|
||||
|
@ -2941,7 +2957,7 @@ snapshots:
|
|||
'@jest/test-result': 29.7.0
|
||||
'@jest/transform': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
chalk: 4.1.2
|
||||
cjs-module-lexer: 1.2.3
|
||||
collect-v8-coverage: 1.0.2
|
||||
|
@ -2987,7 +3003,7 @@ snapshots:
|
|||
jest-util@29.7.0:
|
||||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.9.0
|
||||
graceful-fs: 4.2.11
|
||||
|
@ -3006,7 +3022,7 @@ snapshots:
|
|||
dependencies:
|
||||
'@jest/test-result': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
emittery: 0.13.1
|
||||
|
@ -3015,17 +3031,17 @@ snapshots:
|
|||
|
||||
jest-worker@29.7.0:
|
||||
dependencies:
|
||||
'@types/node': 22.8.6
|
||||
'@types/node': 22.9.0
|
||||
jest-util: 29.7.0
|
||||
merge-stream: 2.0.0
|
||||
supports-color: 8.1.1
|
||||
|
||||
jest@29.7.0(@types/node@22.8.6):
|
||||
jest@29.7.0(@types/node@22.9.0):
|
||||
dependencies:
|
||||
'@jest/core': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
import-local: 3.1.0
|
||||
jest-cli: 29.7.0(@types/node@22.8.6)
|
||||
jest-cli: 29.7.0(@types/node@22.9.0)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- babel-plugin-macros
|
||||
|
@ -3061,7 +3077,7 @@ snapshots:
|
|||
|
||||
kleur@3.0.3: {}
|
||||
|
||||
lemmy-js-client@0.20.0-private-community.9: {}
|
||||
lemmy-js-client@0.20.0-alpha.18: {}
|
||||
|
||||
leven@3.1.0: {}
|
||||
|
||||
|
@ -3342,12 +3358,12 @@ snapshots:
|
|||
dependencies:
|
||||
typescript: 5.6.3
|
||||
|
||||
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.8.6))(typescript@5.6.3):
|
||||
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):
|
||||
dependencies:
|
||||
bs-logger: 0.2.6
|
||||
ejs: 3.1.10
|
||||
fast-json-stable-stringify: 2.1.0
|
||||
jest: 29.7.0(@types/node@22.8.6)
|
||||
jest: 29.7.0(@types/node@22.9.0)
|
||||
jest-util: 29.7.0
|
||||
json5: 2.2.3
|
||||
lodash.memoize: 4.1.2
|
||||
|
@ -3371,11 +3387,11 @@ snapshots:
|
|||
|
||||
type-fest@0.21.3: {}
|
||||
|
||||
typescript-eslint@8.12.2(eslint@9.13.0)(typescript@5.6.3):
|
||||
typescript-eslint@8.13.0(eslint@9.14.0)(typescript@5.6.3):
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/parser': 8.12.2(eslint@9.13.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/utils': 8.12.2(eslint@9.13.0)(typescript@5.6.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/parser': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
||||
'@typescript-eslint/utils': 8.13.0(eslint@9.14.0)(typescript@5.6.3)
|
||||
optionalDependencies:
|
||||
typescript: 5.6.3
|
||||
transitivePeerDependencies:
|
||||
|
|
|
@ -9,7 +9,6 @@ import {
|
|||
CreatePrivateMessageReport,
|
||||
DeleteImage,
|
||||
EditCommunity,
|
||||
GetCommunityPendingFollowsCount,
|
||||
GetCommunityPendingFollowsCountResponse,
|
||||
GetReplies,
|
||||
GetRepliesResponse,
|
||||
|
@ -988,7 +987,7 @@ export function getCommentParentId(comment: Comment): number | undefined {
|
|||
if (split.length > 1) {
|
||||
return Number(split[split.length - 2]);
|
||||
} else {
|
||||
console.log(`Failed to extract comment parent id from ${comment.path}`);
|
||||
console.error(`Failed to extract comment parent id from ${comment.path}`);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
@ -1006,7 +1005,7 @@ export async function waitUntil<T>(
|
|||
result = await fetcher();
|
||||
if (checker(result)) return result;
|
||||
} catch (error) {
|
||||
//console.error(error);
|
||||
console.error(error);
|
||||
}
|
||||
await delay(
|
||||
delaySeconds[Math.min(retry - 1, delaySeconds.length - 1)] * 1000,
|
||||
|
|
|
@ -1,34 +1,39 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_common::{context::LemmyContext, post::HidePost, SuccessResponse};
|
||||
use lemmy_api_common::{
|
||||
context::LemmyContext,
|
||||
post::{HidePost, PostResponse},
|
||||
};
|
||||
use lemmy_db_schema::source::post::PostHide;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult, MAX_API_PARAM_ELEMENTS};
|
||||
use std::collections::HashSet;
|
||||
use lemmy_db_views::structs::{LocalUserView, PostView};
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
#[tracing::instrument(skip(context))]
|
||||
pub async fn hide_post(
|
||||
data: Json<HidePost>,
|
||||
context: Data<LemmyContext>,
|
||||
local_user_view: LocalUserView,
|
||||
) -> LemmyResult<Json<SuccessResponse>> {
|
||||
let post_ids = HashSet::from_iter(data.post_ids.clone());
|
||||
|
||||
if post_ids.len() > MAX_API_PARAM_ELEMENTS {
|
||||
Err(LemmyErrorType::TooManyItems)?;
|
||||
}
|
||||
|
||||
) -> LemmyResult<Json<PostResponse>> {
|
||||
let person_id = local_user_view.person.id;
|
||||
let post_id = data.post_id;
|
||||
|
||||
// Mark the post as hidden / unhidden
|
||||
if data.hide {
|
||||
PostHide::hide(&mut context.pool(), post_ids, person_id)
|
||||
PostHide::hide(&mut context.pool(), post_id, person_id)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntHidePost)?;
|
||||
} else {
|
||||
PostHide::unhide(&mut context.pool(), post_ids, person_id)
|
||||
PostHide::unhide(&mut context.pool(), post_id, person_id)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntHidePost)?;
|
||||
}
|
||||
|
||||
Ok(Json(SuccessResponse::default()))
|
||||
let post_view = PostView::read(
|
||||
&mut context.pool(),
|
||||
post_id,
|
||||
Some(&local_user_view.local_user),
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(Json(PostResponse { post_view }))
|
||||
}
|
||||
|
|
|
@ -1,34 +1,38 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_common::{context::LemmyContext, post::MarkPostAsRead, SuccessResponse};
|
||||
use lemmy_api_common::{
|
||||
context::LemmyContext,
|
||||
post::{MarkPostAsRead, PostResponse},
|
||||
};
|
||||
use lemmy_db_schema::source::post::PostRead;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult, MAX_API_PARAM_ELEMENTS};
|
||||
use std::collections::HashSet;
|
||||
use lemmy_db_views::structs::{LocalUserView, PostView};
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
#[tracing::instrument(skip(context))]
|
||||
pub async fn mark_post_as_read(
|
||||
data: Json<MarkPostAsRead>,
|
||||
context: Data<LemmyContext>,
|
||||
local_user_view: LocalUserView,
|
||||
) -> LemmyResult<Json<SuccessResponse>> {
|
||||
let post_ids = HashSet::from_iter(data.post_ids.clone());
|
||||
|
||||
if post_ids.len() > MAX_API_PARAM_ELEMENTS {
|
||||
Err(LemmyErrorType::TooManyItems)?;
|
||||
}
|
||||
|
||||
) -> LemmyResult<Json<PostResponse>> {
|
||||
let person_id = local_user_view.person.id;
|
||||
let post_id = data.post_id;
|
||||
|
||||
// Mark the post as read / unread
|
||||
if data.read {
|
||||
PostRead::mark_as_read(&mut context.pool(), post_ids, person_id)
|
||||
PostRead::mark_as_read(&mut context.pool(), post_id, person_id)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntMarkPostAsRead)?;
|
||||
} else {
|
||||
PostRead::mark_as_unread(&mut context.pool(), post_ids, person_id)
|
||||
PostRead::mark_as_unread(&mut context.pool(), post_id, person_id)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntMarkPostAsRead)?;
|
||||
}
|
||||
let post_view = PostView::read(
|
||||
&mut context.pool(),
|
||||
post_id,
|
||||
Some(&local_user_view.local_user),
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(Json(SuccessResponse::default()))
|
||||
Ok(Json(PostResponse { post_view }))
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ pub struct RemovePost {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Mark a post as read.
|
||||
pub struct MarkPostAsRead {
|
||||
pub post_ids: Vec<PostId>,
|
||||
pub post_id: PostId,
|
||||
pub read: bool,
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ pub struct MarkPostAsRead {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Hide a post from list views
|
||||
pub struct HidePost {
|
||||
pub post_ids: Vec<PostId>,
|
||||
pub post_id: PostId,
|
||||
pub hide: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ use lemmy_utils::{
|
|||
use moka::future::Cache;
|
||||
use regex::{escape, Regex, RegexSet};
|
||||
use rosetta_i18n::{Language, LanguageId};
|
||||
use std::{collections::HashSet, sync::LazyLock};
|
||||
use std::sync::LazyLock;
|
||||
use tracing::warn;
|
||||
use url::{ParseError, Url};
|
||||
use urlencoding::encode;
|
||||
|
@ -148,7 +148,7 @@ pub async fn mark_post_as_read(
|
|||
post_id: PostId,
|
||||
pool: &mut DbPool<'_>,
|
||||
) -> LemmyResult<()> {
|
||||
PostRead::mark_as_read(pool, HashSet::from([post_id]), person_id)
|
||||
PostRead::mark_as_read(pool, post_id, person_id)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntMarkPostAsRead)?;
|
||||
Ok(())
|
||||
|
|
|
@ -42,7 +42,6 @@ use diesel::{
|
|||
TextExpressionMethods,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use std::collections::HashSet;
|
||||
|
||||
#[async_trait]
|
||||
impl Crud for Post {
|
||||
|
@ -335,39 +334,35 @@ impl Saveable for PostSaved {
|
|||
impl PostRead {
|
||||
pub async fn mark_as_read(
|
||||
pool: &mut DbPool<'_>,
|
||||
post_ids: HashSet<PostId>,
|
||||
post_id: PostId,
|
||||
person_id: PersonId,
|
||||
) -> Result<usize, Error> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
|
||||
let forms = post_ids
|
||||
.into_iter()
|
||||
.map(|post_id| {
|
||||
(
|
||||
PostReadForm { post_id, person_id },
|
||||
let form = (
|
||||
&PostReadForm { post_id, person_id },
|
||||
post_actions::read.eq(now().nullable()),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
);
|
||||
|
||||
insert_into(post_actions::table)
|
||||
.values(forms)
|
||||
.values(form)
|
||||
.on_conflict((post_actions::person_id, post_actions::post_id))
|
||||
.do_update()
|
||||
.set(post_actions::read.eq(now().nullable()))
|
||||
.set(form)
|
||||
.execute(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn mark_as_unread(
|
||||
pool: &mut DbPool<'_>,
|
||||
post_id_: HashSet<PostId>,
|
||||
post_id_: PostId,
|
||||
person_id_: PersonId,
|
||||
) -> Result<uplete::Count, Error> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
|
||||
uplete::new(
|
||||
post_actions::table
|
||||
.filter(post_actions::post_id.eq_any(post_id_))
|
||||
.filter(post_actions::post_id.eq(post_id_))
|
||||
.filter(post_actions::person_id.eq(person_id_)),
|
||||
)
|
||||
.set_null(post_actions::read)
|
||||
|
@ -379,39 +374,34 @@ impl PostRead {
|
|||
impl PostHide {
|
||||
pub async fn hide(
|
||||
pool: &mut DbPool<'_>,
|
||||
post_ids: HashSet<PostId>,
|
||||
post_id: PostId,
|
||||
person_id: PersonId,
|
||||
) -> Result<usize, Error> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
|
||||
let forms = post_ids
|
||||
.into_iter()
|
||||
.map(|post_id| {
|
||||
(
|
||||
PostHideForm { post_id, person_id },
|
||||
let form = (
|
||||
&PostHideForm { post_id, person_id },
|
||||
post_actions::hidden.eq(now().nullable()),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
);
|
||||
insert_into(post_actions::table)
|
||||
.values(forms)
|
||||
.values(form)
|
||||
.on_conflict((post_actions::person_id, post_actions::post_id))
|
||||
.do_update()
|
||||
.set(post_actions::hidden.eq(now().nullable()))
|
||||
.set(form)
|
||||
.execute(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn unhide(
|
||||
pool: &mut DbPool<'_>,
|
||||
post_id_: HashSet<PostId>,
|
||||
post_id_: PostId,
|
||||
person_id_: PersonId,
|
||||
) -> Result<uplete::Count, Error> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
|
||||
uplete::new(
|
||||
post_actions::table
|
||||
.filter(post_actions::post_id.eq_any(post_id_))
|
||||
.filter(post_actions::post_id.eq(post_id_))
|
||||
.filter(post_actions::person_id.eq(person_id_)),
|
||||
)
|
||||
.set_null(post_actions::hidden)
|
||||
|
@ -446,7 +436,6 @@ mod tests {
|
|||
use lemmy_utils::error::LemmyResult;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serial_test::serial;
|
||||
use std::collections::HashSet;
|
||||
use url::Url;
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -547,14 +536,9 @@ mod tests {
|
|||
published: inserted_post_saved.published,
|
||||
};
|
||||
|
||||
// Post Read
|
||||
let marked_as_read = PostRead::mark_as_read(
|
||||
pool,
|
||||
HashSet::from([inserted_post.id, inserted_post2.id]),
|
||||
inserted_person.id,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(2, marked_as_read);
|
||||
// Mark 2 posts as read
|
||||
PostRead::mark_as_read(pool, inserted_post.id, inserted_person.id).await?;
|
||||
PostRead::mark_as_read(pool, inserted_post2.id, inserted_person.id).await?;
|
||||
|
||||
let read_post = Post::read(pool, inserted_post.id).await?;
|
||||
|
||||
|
@ -572,17 +556,19 @@ mod tests {
|
|||
assert_eq!(uplete::Count::only_updated(1), like_removed);
|
||||
let saved_removed = PostSaved::unsave(pool, &post_saved_form).await?;
|
||||
assert_eq!(uplete::Count::only_updated(1), saved_removed);
|
||||
let read_removed = PostRead::mark_as_unread(
|
||||
pool,
|
||||
HashSet::from([inserted_post.id, inserted_post2.id]),
|
||||
inserted_person.id,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(uplete::Count::only_deleted(2), read_removed);
|
||||
|
||||
let read_removed_1 =
|
||||
PostRead::mark_as_unread(pool, inserted_post.id, inserted_person.id).await?;
|
||||
assert_eq!(uplete::Count::only_deleted(1), read_removed_1);
|
||||
|
||||
let read_removed_2 =
|
||||
PostRead::mark_as_unread(pool, inserted_post2.id, inserted_person.id).await?;
|
||||
assert_eq!(uplete::Count::only_deleted(1), read_removed_2);
|
||||
|
||||
let num_deleted = Post::delete(pool, inserted_post.id).await?
|
||||
+ Post::delete(pool, inserted_post2.id).await?
|
||||
+ Post::delete(pool, inserted_scheduled_post.id).await?;
|
||||
|
||||
assert_eq!(3, num_deleted);
|
||||
Community::delete(pool, inserted_community.id).await?;
|
||||
Person::delete(pool, inserted_person.id).await?;
|
||||
|
|
|
@ -656,10 +656,7 @@ mod tests {
|
|||
use lemmy_utils::error::LemmyResult;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serial_test::serial;
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use std::time::{Duration, Instant};
|
||||
use url::Url;
|
||||
|
||||
const POST_WITH_ANOTHER_TITLE: &str = "Another title";
|
||||
|
@ -1526,7 +1523,7 @@ mod tests {
|
|||
// Mark a post as read
|
||||
PostRead::mark_as_read(
|
||||
pool,
|
||||
HashSet::from([data.inserted_bot_post.id]),
|
||||
data.inserted_bot_post.id,
|
||||
data.local_user_view.person.id,
|
||||
)
|
||||
.await?;
|
||||
|
@ -1568,7 +1565,7 @@ mod tests {
|
|||
// Mark a post as hidden
|
||||
PostHide::hide(
|
||||
pool,
|
||||
HashSet::from([data.inserted_bot_post.id]),
|
||||
data.inserted_bot_post.id,
|
||||
data.local_user_view.person.id,
|
||||
)
|
||||
.await?;
|
||||
|
|
Loading…
Reference in a new issue