refactor: introduce bindThis decorator to bind this automaticaly
This commit is contained in:
@@ -11,6 +11,7 @@ import { CreateNotificationService } from '@/core/CreateNotificationService.js';
|
||||
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { ApDeliverManagerService } from '@/core/activitypub/ApDeliverManagerService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
||||
@Injectable()
|
||||
export class PollService {
|
||||
@@ -40,6 +41,7 @@ export class PollService {
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async vote(user: CacheableUser, note: Note, choice: number) {
|
||||
const poll = await this.pollsRepository.findOneBy({ noteId: note.id });
|
||||
|
||||
@@ -99,6 +101,7 @@ export class PollService {
|
||||
});
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async deliverQuestionUpdate(noteId: Note['id']) {
|
||||
const note = await this.notesRepository.findOneBy({ id: noteId });
|
||||
if (note == null) throw new Error('note not found');
|
||||
|
Reference in New Issue
Block a user