Merge branch 'develop' of codeberg.org:calckey/calckey into develop

This commit is contained in:
ThatOneCalculator 2023-02-12 12:07:15 -08:00
commit 9f8bebf5f8
No known key found for this signature in database
GPG key ID: 8703CACD01000000
4 changed files with 29 additions and 13 deletions

View file

@ -1,7 +1,7 @@
import define from "../../define.js";
import { Users } from "@/models/index.js";
import { User } from "@/models/entities/user.js";
import { insertModerationLog } from "@/services/insert-moderation-log.js";
import { publishInternalEvent } from "@/services/stream.js";
export const meta = {
tags: ["admin"],
@ -29,17 +29,14 @@ export default define(meta, paramDef, async (ps, me) => {
throw new Error("user is not local user");
}
/*if (user.isAdmin) {
throw new Error('cannot suspend admin');
}
if (user.isModerator) {
throw new Error('cannot suspend moderator');
}*/
await Users.update(user.id, {
driveCapacityOverrideMb: ps.overrideMb,
});
publishInternalEvent("localUserUpdated", {
id: user.id,
});
insertModerationLog(me, "change-drive-capacity-override", {
targetId: user.id,
});

View file

@ -7,7 +7,6 @@ import type { Note } from "@/models/entities/note.js";
import type { Antenna } from "@/models/entities/antenna.js";
import type { DriveFile } from "@/models/entities/drive-file.js";
import type { DriveFolder } from "@/models/entities/drive-folder.js";
import { Emoji } from "@/models/entities/emoji.js";
import type { UserList } from "@/models/entities/user-list.js";
import type { MessagingMessage } from "@/models/entities/messaging-message.js";
import type { UserGroup } from "@/models/entities/user-group.js";
@ -23,7 +22,10 @@ export interface InternalStreamTypes {
id: User["id"];
isSuspended: User["isSuspended"];
};
userChangeSilencedState: { id: User["id"]; isSilenced: User["isSilenced"] };
userChangeSilencedState: {
id: User["id"];
isSilenced: User["isSilenced"];
};
userChangeModeratorState: {
id: User["id"];
isModerator: User["isModerator"];
@ -33,7 +35,12 @@ export interface InternalStreamTypes {
oldToken: User["token"];
newToken: User["token"];
};
remoteUserUpdated: { id: User["id"] };
localUserUpdated: {
id: User["id"];
};
remoteUserUpdated: {
id: User["id"];
};
webhookCreated: Webhook;
webhookDeleted: Webhook;
webhookUpdated: Webhook;

View file

@ -21,6 +21,16 @@ subscriber.on("message", async (_, data) => {
if (obj.channel === "internal") {
const { type, body } = obj.message;
switch (type) {
case "localUserUpdated": {
userByIdCache.delete(body.id);
localUserByIdCache.delete(body.id);
localUserByNativeTokenCache.cache.forEach((v, k) => {
if (v.value?.id === body.id) {
localUserByNativeTokenCache.delete(k);
}
});
break;
}
case "userChangeSuspendedState":
case "userChangeSilencedState":
case "userChangeModeratorState":

View file

@ -152,14 +152,16 @@ onMounted(() => {
if (tabEl && tabHighlightEl) {
// offsetWidth offsetLeft getBoundingClientRect 使
// https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4
tabEl.addEventListener("transitionend", () => {
function transition() {
const parentRect = tabsEl.getBoundingClientRect();
const rect = tabEl.getBoundingClientRect();
const left = (rect.left - parentRect.left + tabsEl?.scrollLeft);
tabHighlightEl.style.width = rect.width + 'px';
tabHighlightEl.style.left = left + 'px';
tabsEl?.scrollTo({left: left - 80, behavior: "smooth"});
})
tabEl.removeEventListener("transitionend", transition);
}
tabEl.addEventListener("transitionend", transition);
}
});
}, {