mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
Fixes for wrong follows
This commit is contained in:
parent
6c60191ab2
commit
8bda61e099
|
|
@ -63,12 +63,13 @@ export const getFromRequest = async (req: Request): Promise<AuthData> => {
|
||||||
export const followUser = async (
|
export const followUser = async (
|
||||||
follower: User,
|
follower: User,
|
||||||
followee: User,
|
followee: User,
|
||||||
|
relationshipId: string,
|
||||||
reblogs = false,
|
reblogs = false,
|
||||||
notify = false,
|
notify = false,
|
||||||
languages: string[] = [],
|
languages: string[] = [],
|
||||||
) => {
|
) => {
|
||||||
const relationship = await client.relationship.update({
|
const relationship = await client.relationship.update({
|
||||||
where: { id: follower.id },
|
where: { id: relationshipId },
|
||||||
data: {
|
data: {
|
||||||
following: true,
|
following: true,
|
||||||
showingReblogs: reblogs,
|
showingReblogs: reblogs,
|
||||||
|
|
@ -96,12 +97,13 @@ export const followUser = async (
|
||||||
export const followRequestUser = async (
|
export const followRequestUser = async (
|
||||||
follower: User,
|
follower: User,
|
||||||
followee: User,
|
followee: User,
|
||||||
|
relationshipId: string,
|
||||||
reblogs = false,
|
reblogs = false,
|
||||||
notify = false,
|
notify = false,
|
||||||
languages: string[] = [],
|
languages: string[] = [],
|
||||||
) => {
|
) => {
|
||||||
const relationship = await client.relationship.update({
|
const relationship = await client.relationship.update({
|
||||||
where: { id: follower.id },
|
where: { id: relationshipId },
|
||||||
data: {
|
data: {
|
||||||
requested: true,
|
requested: true,
|
||||||
showingReblogs: reblogs,
|
showingReblogs: reblogs,
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ export default apiRoute<{
|
||||||
relationship = await followRequestUser(
|
relationship = await followRequestUser(
|
||||||
self,
|
self,
|
||||||
user,
|
user,
|
||||||
|
relationship.id,
|
||||||
reblogs,
|
reblogs,
|
||||||
notify,
|
notify,
|
||||||
languages,
|
languages,
|
||||||
|
|
@ -70,6 +71,7 @@ export default apiRoute<{
|
||||||
relationship = await followUser(
|
relationship = await followUser(
|
||||||
self,
|
self,
|
||||||
user,
|
user,
|
||||||
|
relationship.id,
|
||||||
reblogs,
|
reblogs,
|
||||||
notify,
|
notify,
|
||||||
languages,
|
languages,
|
||||||
|
|
|
||||||
|
|
@ -666,7 +666,7 @@ describe("API Tests", () => {
|
||||||
const account = (await response.json()) as APIAccount;
|
const account = (await response.json()) as APIAccount;
|
||||||
|
|
||||||
expect(account.id).toBeDefined();
|
expect(account.id).toBeDefined();
|
||||||
expect(account.avatar).toBe("");
|
expect(account.avatar).toBeDefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue