Adding optional auth to modlog fetches.

This commit is contained in:
Dessalines 2021-12-14 13:03:14 -05:00
parent 733cbf8829
commit a1cb49994f
3 changed files with 10 additions and 5 deletions

View file

@ -72,7 +72,7 @@
"husky": "^7.0.4", "husky": "^7.0.4",
"import-sort-style-module": "^6.0.0", "import-sort-style-module": "^6.0.0",
"iso-639-1": "^2.1.10", "iso-639-1": "^2.1.10",
"lemmy-js-client": "0.15.0-rc.2", "lemmy-js-client": "0.15.0-rc.6",
"lint-staged": "^12.1.2", "lint-staged": "^12.1.2",
"mini-css-extract-plugin": "^2.4.5", "mini-css-extract-plugin": "^2.4.5",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",

View file

@ -25,9 +25,11 @@ import { i18n } from "../i18next";
import { InitialFetchRequest } from "../interfaces"; import { InitialFetchRequest } from "../interfaces";
import { UserService, WebSocketService } from "../services"; import { UserService, WebSocketService } from "../services";
import { import {
authField,
fetchLimit, fetchLimit,
isBrowser, isBrowser,
setIsoData, setIsoData,
setOptionalAuth,
toast, toast,
wsClient, wsClient,
wsJsonToRes, wsJsonToRes,
@ -482,6 +484,7 @@ export class Modlog extends Component<any, ModlogState> {
community_id: this.state.communityId, community_id: this.state.communityId,
page: this.state.page, page: this.state.page,
limit: fetchLimit, limit: fetchLimit,
auth: authField(false),
}; };
WebSocketService.Instance.send(wsClient.getModlog(modlogForm)); WebSocketService.Instance.send(wsClient.getModlog(modlogForm));
@ -507,6 +510,7 @@ export class Modlog extends Component<any, ModlogState> {
if (communityId) { if (communityId) {
modlogForm.community_id = Number(communityId); modlogForm.community_id = Number(communityId);
} }
setOptionalAuth(modlogForm, req.auth);
promises.push(req.client.getModlog(modlogForm)); promises.push(req.client.getModlog(modlogForm));
@ -514,6 +518,7 @@ export class Modlog extends Component<any, ModlogState> {
let communityForm: GetCommunity = { let communityForm: GetCommunity = {
id: Number(communityId), id: Number(communityId),
}; };
setOptionalAuth(communityForm, req.auth);
promises.push(req.client.getCommunity(communityForm)); promises.push(req.client.getCommunity(communityForm));
} }
return promises; return promises;

View file

@ -4997,10 +4997,10 @@ lcid@^1.0.0:
dependencies: dependencies:
invert-kv "^1.0.0" invert-kv "^1.0.0"
lemmy-js-client@0.15.0-rc.2: lemmy-js-client@0.15.0-rc.6:
version "0.15.0-rc.2" version "0.15.0-rc.6"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.15.0-rc.2.tgz#e4e10edf844d90bde9915e578ced319cbd058109" resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.15.0-rc.6.tgz#5f8552488ed82b8c0962c158edccb8ce1d56389e"
integrity sha512-qb+70MQQJ2pMNxroW+E8MNSXOrSxr3/qLO81GuAa/JT2AzbbY7mO/aXPFSrbyZWu5kn0K99alctEOC3m7mwEGw== integrity sha512-eSEZ5+F2ScKVtx+wwjdReHirJBNLQL2YdTV4aMCBWaSsxfsXUcz18/urbNxo+fNMc7Q4u0aRd3737yKBeMP9Kw==
levn@^0.4.1: levn@^0.4.1:
version "0.4.1" version "0.4.1"