mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 08:53:48 +01:00
fix
This commit is contained in:
parent
98f7ebd3f7
commit
9e2443634c
@ -30,7 +30,7 @@ export const paramDef = {
|
||||
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
// Check if announcement exists
|
||||
const exist = await Announcements.findOneBy({
|
||||
const exist = await Announcements.exist({
|
||||
where: { id: ps.announcementId },
|
||||
});
|
||||
|
||||
@ -39,12 +39,14 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
}
|
||||
|
||||
// Check if already read
|
||||
const read = await AnnouncementReads.findOneBy({
|
||||
announcementId: ps.announcementId,
|
||||
userId: user.id,
|
||||
const read = await AnnouncementReads.exist({
|
||||
where: {
|
||||
announcementId: ps.announcementId,
|
||||
userId: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (read != null) {
|
||||
if (read) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -52,14 +52,14 @@ export const paramDef = {
|
||||
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
// Fetch the list
|
||||
const userList = await UserLists.exist({
|
||||
const listExists = await UserLists.exist({
|
||||
where: {
|
||||
id: ps.listId,
|
||||
userId: me.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (!exist) {
|
||||
if (!listExists) {
|
||||
throw new ApiError(meta.errors.noSuchList);
|
||||
}
|
||||
|
||||
@ -72,18 +72,22 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||
|
||||
// Check blocking
|
||||
if (user.id !== me.id) {
|
||||
const block = await Blockings.findOneBy({
|
||||
blockerId: user.id,
|
||||
blockeeId: me.id,
|
||||
const isBlocked = await Blockings.exist({
|
||||
where: {
|
||||
blockerId: user.id,
|
||||
blockeeId: me.id,
|
||||
},
|
||||
});
|
||||
if (block) {
|
||||
if (isBlocked) {
|
||||
throw new ApiError(meta.errors.youHaveBeenBlocked);
|
||||
}
|
||||
}
|
||||
|
||||
const exist = await UserListJoinings.findOneBy({
|
||||
userListId: userList.id,
|
||||
userId: user.id,
|
||||
const exist = await UserListJoinings.exist({
|
||||
where: {
|
||||
userListId: userList.id,
|
||||
userId: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (exist) {
|
||||
|
Loading…
Reference in New Issue
Block a user