wip #6441
This commit is contained in:
parent
41b491fa7c
commit
c4c20bee7c
28 changed files with 44 additions and 40 deletions
|
|
@ -247,7 +247,7 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
|
|||
for (const u of us) {
|
||||
checkWordMute(note, { id: u.userId }, u.mutedWords).then(shouldMute => {
|
||||
if (shouldMute) {
|
||||
MutedNotes.save({
|
||||
MutedNotes.insert({
|
||||
id: genId(),
|
||||
userId: u.userId,
|
||||
noteId: note.id,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default async function(user: User, note: Note, choice: number) {
|
|||
}
|
||||
|
||||
// Create vote
|
||||
await PollVotes.save({
|
||||
await PollVotes.insert({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
noteId: note.id,
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@ export default async (user: User, note: Note, reaction?: string) => {
|
|||
// TODO: cache
|
||||
reaction = await toDbReaction(reaction, user.host);
|
||||
|
||||
let record: NoteReaction;
|
||||
let record: NoteReaction = {
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
noteId: note.id,
|
||||
userId: user.id,
|
||||
reaction
|
||||
};
|
||||
|
||||
// Create reaction
|
||||
try {
|
||||
record = await NoteReactions.save({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
noteId: note.id,
|
||||
userId: user.id,
|
||||
reaction
|
||||
});
|
||||
await NoteReactions.insert(record);
|
||||
} catch (e) {
|
||||
if (isDuplicateKeyValueError(e)) {
|
||||
record = await NoteReactions.findOneOrFail({
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export default async function(userId: User['id'], note: Note, params: {
|
|||
if (mute.map(m => m.muteeId).includes(note.userId)) return;
|
||||
//#endregion
|
||||
|
||||
const unread = await NoteUnreads.save({
|
||||
const unread = {
|
||||
id: genId(),
|
||||
noteId: note.id,
|
||||
userId: userId,
|
||||
|
|
@ -25,7 +25,9 @@ export default async function(userId: User['id'], note: Note, params: {
|
|||
isMentioned: params.isMentioned,
|
||||
noteChannelId: note.channelId,
|
||||
noteUserId: note.userId,
|
||||
});
|
||||
};
|
||||
|
||||
await NoteUnreads.insert(unread);
|
||||
|
||||
// 2秒経っても既読にならなかったら「未読の投稿がありますよ」イベントを発行する
|
||||
setTimeout(async () => {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default async (me: User['id'], note: Note) => {
|
|||
return;
|
||||
}
|
||||
|
||||
await NoteWatchings.save({
|
||||
await NoteWatchings.insert({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
noteId: note.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue