Merge branch 'develop' into swn
This commit is contained in:
commit
20649f5ae1
93 changed files with 1347 additions and 746 deletions
|
|
@ -75,6 +75,11 @@ export class UserProfile {
|
|||
})
|
||||
public emailNotificationTypes: string[];
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
public publicReactions: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { EntityRepository, Repository } from 'typeorm';
|
||||
import { NoteReaction } from '@/models/entities/note-reaction';
|
||||
import { Users } from '../index';
|
||||
import { Notes, Users } from '../index';
|
||||
import { Packed } from '@/misc/schema';
|
||||
import { convertLegacyReaction } from '@/misc/reaction-lib';
|
||||
import { User } from '@/models/entities/user';
|
||||
|
|
@ -9,8 +9,15 @@ import { User } from '@/models/entities/user';
|
|||
export class NoteReactionRepository extends Repository<NoteReaction> {
|
||||
public async pack(
|
||||
src: NoteReaction['id'] | NoteReaction,
|
||||
me?: { id: User['id'] } | null | undefined
|
||||
me?: { id: User['id'] } | null | undefined,
|
||||
options?: {
|
||||
withNote: boolean;
|
||||
},
|
||||
): Promise<Packed<'NoteReaction'>> {
|
||||
const opts = Object.assign({
|
||||
withNote: false,
|
||||
}, options);
|
||||
|
||||
const reaction = typeof src === 'object' ? src : await this.findOneOrFail(src);
|
||||
|
||||
return {
|
||||
|
|
@ -18,6 +25,9 @@ export class NoteReactionRepository extends Repository<NoteReaction> {
|
|||
createdAt: reaction.createdAt.toISOString(),
|
||||
user: await Users.pack(reaction.userId, me),
|
||||
type: convertLegacyReaction(reaction.reaction),
|
||||
...(opts.withNote ? {
|
||||
note: await Notes.pack(reaction.noteId, me),
|
||||
} : {})
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ export class UserRepository extends Repository<User> {
|
|||
}),
|
||||
pinnedPageId: profile!.pinnedPageId,
|
||||
pinnedPage: profile!.pinnedPageId ? Pages.pack(profile!.pinnedPageId, me) : null,
|
||||
publicReactions: profile!.publicReactions,
|
||||
twoFactorEnabled: profile!.twoFactorEnabled,
|
||||
usePasswordLessLogin: profile!.usePasswordLessLogin,
|
||||
securityKeys: profile!.twoFactorEnabled
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue