parent
10cd4754fd
commit
9bc0110b86
@ -12,7 +12,7 @@ import { extractApHashtags } from './tag';
|
|||||||
import { apLogger } from '../logger';
|
import { apLogger } from '../logger';
|
||||||
import { Note } from '../../../models/entities/note';
|
import { Note } from '../../../models/entities/note';
|
||||||
import { updateUsertags } from '../../../services/update-hashtag';
|
import { updateUsertags } from '../../../services/update-hashtag';
|
||||||
import { Users, UserNotePinings, Instances, DriveFiles, Followings, UserProfiles, UserPublickeys } from '../../../models';
|
import { Users, Instances, DriveFiles, Followings, UserProfiles, UserPublickeys } from '../../../models';
|
||||||
import { User, IRemoteUser } from '../../../models/entities/user';
|
import { User, IRemoteUser } from '../../../models/entities/user';
|
||||||
import { Emoji } from '../../../models/entities/emoji';
|
import { Emoji } from '../../../models/entities/emoji';
|
||||||
import { UserNotePining } from '../../../models/entities/user-note-pining';
|
import { UserNotePining } from '../../../models/entities/user-note-pining';
|
||||||
@ -479,18 +479,19 @@ export async function updateFeatured(userId: User['id']) {
|
|||||||
.slice(0, 5)
|
.slice(0, 5)
|
||||||
.map(item => limit(() => resolveNote(item, resolver))));
|
.map(item => limit(() => resolveNote(item, resolver))));
|
||||||
|
|
||||||
// delete
|
await getConnection().transaction(async transactionalEntityManager => {
|
||||||
await UserNotePinings.delete({ userId: user.id });
|
await transactionalEntityManager.delete(UserNotePining, { userId: user.id });
|
||||||
|
|
||||||
// とりあえずidを別の時間で生成して順番を維持
|
// とりあえずidを別の時間で生成して順番を維持
|
||||||
let td = 0;
|
let td = 0;
|
||||||
for (const note of featuredNotes.filter(note => note != null)) {
|
for (const note of featuredNotes.filter(note => note != null)) {
|
||||||
td -= 1000;
|
td -= 1000;
|
||||||
UserNotePinings.save({
|
transactionalEntityManager.insert(UserNotePining, {
|
||||||
id: genId(new Date(Date.now() + td)),
|
id: genId(new Date(Date.now() + td)),
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
noteId: note!.id
|
noteId: note!.id
|
||||||
} as UserNotePining);
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user