fix: remove notes count
This commit is contained in:
parent
2ce855d23c
commit
ed26870807
3 changed files with 15 additions and 12 deletions
|
@ -35,7 +35,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
id: ps.channelId,
|
id: ps.channelId,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (channel == null) {
|
if (!channel) {
|
||||||
throw new ApiError(meta.errors.noSuchChannel);
|
throw new ApiError(meta.errors.noSuchChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { isUserRelated } from "@/misc/is-user-related.js";
|
||||||
import type { User } from "@/models/entities/user.js";
|
import type { User } from "@/models/entities/user.js";
|
||||||
import type { StreamMessages } from "../types.js";
|
import type { StreamMessages } from "../types.js";
|
||||||
import type { Packed } from "@/misc/schema.js";
|
import type { Packed } from "@/misc/schema.js";
|
||||||
|
import { scyllaClient } from "@/db/scylla.js";
|
||||||
|
|
||||||
export default class extends Channel {
|
export default class extends Channel {
|
||||||
public readonly chName = "channel";
|
public readonly chName = "channel";
|
||||||
|
@ -45,7 +46,7 @@ export default class extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private onEvent(data: StreamMessages["channel"]["payload"]) {
|
private onEvent(data: StreamMessages["channel"]["payload"]) {
|
||||||
if (data.type === "typing") {
|
if (data.type === "typing" && !scyllaClient) {
|
||||||
const id = data.body;
|
const id = data.body;
|
||||||
const begin = !this.typers.has(id);
|
const begin = !this.typers.has(id);
|
||||||
this.typers.set(id, new Date());
|
this.typers.set(id, new Date());
|
||||||
|
|
|
@ -651,6 +651,7 @@ export default async (
|
||||||
lastNotedAt: new Date(),
|
lastNotedAt: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!scyllaClient) {
|
||||||
await Notes.countBy({
|
await Notes.countBy({
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
channelId: data.channel.id,
|
channelId: data.channel.id,
|
||||||
|
@ -662,6 +663,7 @@ export default async (
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Register to search database
|
// Register to search database
|
||||||
await index(note, false);
|
await index(note, false);
|
||||||
|
|
Loading…
Reference in a new issue