mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
Bugfix quote posts with mentions not working
This commit is contained in:
parent
310f8d2739
commit
a1b251dfdf
|
|
@ -79,7 +79,6 @@ export type StatusWithoutRecursiveRelations = Omit<
|
||||||
| "inReplyTo"
|
| "inReplyTo"
|
||||||
| "quoting"
|
| "quoting"
|
||||||
| "reblog"
|
| "reblog"
|
||||||
| "mentions"
|
|
||||||
| "reblogCount"
|
| "reblogCount"
|
||||||
| "likeCount"
|
| "likeCount"
|
||||||
| "replyCount"
|
| "replyCount"
|
||||||
|
|
@ -193,10 +192,10 @@ export const findManyStatuses = async (
|
||||||
mentions: {
|
mentions: {
|
||||||
with: {
|
with: {
|
||||||
user: {
|
user: {
|
||||||
with: {
|
with: userRelations,
|
||||||
instance: true,
|
extras: userExtrasTemplate(
|
||||||
relationships: true,
|
"status_reblog_mentions_user",
|
||||||
},
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -225,10 +224,10 @@ export const findManyStatuses = async (
|
||||||
mentions: {
|
mentions: {
|
||||||
with: {
|
with: {
|
||||||
user: {
|
user: {
|
||||||
with: {
|
with: userRelations,
|
||||||
instance: true,
|
extras: userExtrasTemplate(
|
||||||
relationships: true,
|
"status_inReplyTo_mentions_user",
|
||||||
},
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -257,10 +256,10 @@ export const findManyStatuses = async (
|
||||||
mentions: {
|
mentions: {
|
||||||
with: {
|
with: {
|
||||||
user: {
|
user: {
|
||||||
with: {
|
with: userRelations,
|
||||||
instance: true,
|
extras: userExtrasTemplate(
|
||||||
relationships: true,
|
"status_quoting_mentions_user",
|
||||||
},
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -290,6 +289,11 @@ export const findManyStatuses = async (
|
||||||
reblog: post.reblog && {
|
reblog: post.reblog && {
|
||||||
...post.reblog,
|
...post.reblog,
|
||||||
author: transformOutputToUserWithRelations(post.reblog.author),
|
author: transformOutputToUserWithRelations(post.reblog.author),
|
||||||
|
mentions: post.reblog.mentions.map(
|
||||||
|
(mention) =>
|
||||||
|
mention.user &&
|
||||||
|
transformOutputToUserWithRelations(mention.user),
|
||||||
|
),
|
||||||
emojis: post.reblog.emojis.map(
|
emojis: post.reblog.emojis.map(
|
||||||
(emoji) =>
|
(emoji) =>
|
||||||
(emoji as unknown as Record<string, object>)
|
(emoji as unknown as Record<string, object>)
|
||||||
|
|
@ -299,6 +303,11 @@ export const findManyStatuses = async (
|
||||||
inReplyTo: post.inReplyTo && {
|
inReplyTo: post.inReplyTo && {
|
||||||
...post.inReplyTo,
|
...post.inReplyTo,
|
||||||
author: transformOutputToUserWithRelations(post.inReplyTo.author),
|
author: transformOutputToUserWithRelations(post.inReplyTo.author),
|
||||||
|
mentions: post.inReplyTo.mentions.map(
|
||||||
|
(mention) =>
|
||||||
|
mention.user &&
|
||||||
|
transformOutputToUserWithRelations(mention.user),
|
||||||
|
),
|
||||||
emojis: post.inReplyTo.emojis.map(
|
emojis: post.inReplyTo.emojis.map(
|
||||||
(emoji) =>
|
(emoji) =>
|
||||||
(emoji as unknown as Record<string, object>)
|
(emoji as unknown as Record<string, object>)
|
||||||
|
|
@ -308,6 +317,11 @@ export const findManyStatuses = async (
|
||||||
quoting: post.quoting && {
|
quoting: post.quoting && {
|
||||||
...post.quoting,
|
...post.quoting,
|
||||||
author: transformOutputToUserWithRelations(post.quoting.author),
|
author: transformOutputToUserWithRelations(post.quoting.author),
|
||||||
|
mentions: post.quoting.mentions.map(
|
||||||
|
(mention) =>
|
||||||
|
mention.user &&
|
||||||
|
transformOutputToUserWithRelations(mention.user),
|
||||||
|
),
|
||||||
emojis: post.quoting.emojis.map(
|
emojis: post.quoting.emojis.map(
|
||||||
(emoji) =>
|
(emoji) =>
|
||||||
(emoji as unknown as Record<string, object>)
|
(emoji as unknown as Record<string, object>)
|
||||||
|
|
@ -336,6 +350,15 @@ export const findFirstStatuses = async (
|
||||||
where: (attachment, { eq }) =>
|
where: (attachment, { eq }) =>
|
||||||
eq(attachment.statusId, sql`"status"."id"`),
|
eq(attachment.statusId, sql`"status"."id"`),
|
||||||
},
|
},
|
||||||
|
emojis: {
|
||||||
|
with: {
|
||||||
|
emoji: {
|
||||||
|
with: {
|
||||||
|
instance: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
author: {
|
author: {
|
||||||
with: {
|
with: {
|
||||||
...userRelations,
|
...userRelations,
|
||||||
|
|
@ -349,7 +372,6 @@ export const findFirstStatuses = async (
|
||||||
extras: userExtrasTemplate("status_mentions_user"),
|
extras: userExtrasTemplate("status_mentions_user"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
where: (mention, { eq }) => eq(mention.a, sql`"status"."id"`),
|
|
||||||
},
|
},
|
||||||
reblog: {
|
reblog: {
|
||||||
with: {
|
with: {
|
||||||
|
|
@ -368,10 +390,10 @@ export const findFirstStatuses = async (
|
||||||
mentions: {
|
mentions: {
|
||||||
with: {
|
with: {
|
||||||
user: {
|
user: {
|
||||||
with: {
|
with: userRelations,
|
||||||
instance: true,
|
extras: userExtrasTemplate(
|
||||||
relationships: true,
|
"status_reblog_mentions_user",
|
||||||
},
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -400,10 +422,10 @@ export const findFirstStatuses = async (
|
||||||
mentions: {
|
mentions: {
|
||||||
with: {
|
with: {
|
||||||
user: {
|
user: {
|
||||||
with: {
|
with: userRelations,
|
||||||
instance: true,
|
extras: userExtrasTemplate(
|
||||||
relationships: true,
|
"status_inReplyTo_mentions_user",
|
||||||
},
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -432,10 +454,10 @@ export const findFirstStatuses = async (
|
||||||
mentions: {
|
mentions: {
|
||||||
with: {
|
with: {
|
||||||
user: {
|
user: {
|
||||||
with: {
|
with: userRelations,
|
||||||
instance: true,
|
extras: userExtrasTemplate(
|
||||||
relationships: true,
|
"status_quoting_mentions_user",
|
||||||
},
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -465,6 +487,11 @@ export const findFirstStatuses = async (
|
||||||
reblog: output.reblog && {
|
reblog: output.reblog && {
|
||||||
...output.reblog,
|
...output.reblog,
|
||||||
author: transformOutputToUserWithRelations(output.reblog.author),
|
author: transformOutputToUserWithRelations(output.reblog.author),
|
||||||
|
mentions: output.reblog.mentions.map(
|
||||||
|
(mention) =>
|
||||||
|
mention.user &&
|
||||||
|
transformOutputToUserWithRelations(mention.user),
|
||||||
|
),
|
||||||
emojis: output.reblog.emojis.map(
|
emojis: output.reblog.emojis.map(
|
||||||
(emoji) =>
|
(emoji) =>
|
||||||
(emoji as unknown as Record<string, object>)
|
(emoji as unknown as Record<string, object>)
|
||||||
|
|
@ -474,6 +501,11 @@ export const findFirstStatuses = async (
|
||||||
inReplyTo: output.inReplyTo && {
|
inReplyTo: output.inReplyTo && {
|
||||||
...output.inReplyTo,
|
...output.inReplyTo,
|
||||||
author: transformOutputToUserWithRelations(output.inReplyTo.author),
|
author: transformOutputToUserWithRelations(output.inReplyTo.author),
|
||||||
|
mentions: output.inReplyTo.mentions.map(
|
||||||
|
(mention) =>
|
||||||
|
mention.user &&
|
||||||
|
transformOutputToUserWithRelations(mention.user),
|
||||||
|
),
|
||||||
emojis: output.inReplyTo.emojis.map(
|
emojis: output.inReplyTo.emojis.map(
|
||||||
(emoji) =>
|
(emoji) =>
|
||||||
(emoji as unknown as Record<string, object>)
|
(emoji as unknown as Record<string, object>)
|
||||||
|
|
@ -483,6 +515,11 @@ export const findFirstStatuses = async (
|
||||||
quoting: output.quoting && {
|
quoting: output.quoting && {
|
||||||
...output.quoting,
|
...output.quoting,
|
||||||
author: transformOutputToUserWithRelations(output.quoting.author),
|
author: transformOutputToUserWithRelations(output.quoting.author),
|
||||||
|
mentions: output.quoting.mentions.map(
|
||||||
|
(mention) =>
|
||||||
|
mention.user &&
|
||||||
|
transformOutputToUserWithRelations(mention.user),
|
||||||
|
),
|
||||||
emojis: output.quoting.emojis.map(
|
emojis: output.quoting.emojis.map(
|
||||||
(emoji) =>
|
(emoji) =>
|
||||||
(emoji as unknown as Record<string, object>)
|
(emoji as unknown as Record<string, object>)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue