Renote button optimization
This commit is contained in:
parent
12f0bd4e2d
commit
e4b8b35e82
|
@ -38,6 +38,7 @@ export const paramDef = {
|
|||
type: "object",
|
||||
properties: {
|
||||
noteId: { type: "string", format: "misskey:id" },
|
||||
userId: { type: "string", format: "misskey:id" },
|
||||
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
|
||||
sinceId: { type: "string", format: "misskey:id" },
|
||||
untilId: { type: "string", format: "misskey:id" },
|
||||
|
@ -52,13 +53,19 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
throw err;
|
||||
});
|
||||
|
||||
const query = makePaginationQuery(
|
||||
let query = makePaginationQuery(
|
||||
Notes.createQueryBuilder("note"),
|
||||
ps.sinceId,
|
||||
ps.untilId,
|
||||
)
|
||||
.andWhere("note.renoteId = :renoteId", { renoteId: note.id })
|
||||
.innerJoinAndSelect("note.user", "user")
|
||||
.innerJoinAndSelect("note.user", "user");
|
||||
|
||||
if (ps.userId) {
|
||||
query.andWhere("user.id = :userId", { userId: ps.userId });
|
||||
}
|
||||
|
||||
query
|
||||
.leftJoinAndSelect("user.avatar", "avatar")
|
||||
.leftJoinAndSelect("user.banner", "banner")
|
||||
.leftJoinAndSelect("note.reply", "reply")
|
||||
|
|
|
@ -58,11 +58,11 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => {
|
|||
|
||||
const renotes = await os.api('notes/renotes', {
|
||||
noteId: props.note.id,
|
||||
limit: 11,
|
||||
userId: $i.id,
|
||||
limit: 1,
|
||||
});
|
||||
|
||||
const users = renotes.map(x => x.user.id);
|
||||
const hasRenotedBefore = users.includes($i.id);
|
||||
const hasRenotedBefore = renotes.length > 0;
|
||||
|
||||
let buttonActions = [{
|
||||
text: i18n.ts.renote,
|
||||
|
|
Loading…
Reference in New Issue