mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-10-30 06:41:46 +09:00
add achievement
This commit is contained in:
parent
7fdf298bd4
commit
26ae2dfc0f
@ -1049,6 +1049,9 @@ _achievements:
|
||||
_noteFavorited1:
|
||||
title: "星をみるひと"
|
||||
description: "初めてノートをお気に入りに登録した"
|
||||
_myNoteFavorited1:
|
||||
title: "星が欲しい"
|
||||
description: "自分のノートが他の人からお気に入りに登録された"
|
||||
_profileFilled:
|
||||
title: "準備万端"
|
||||
description: "プロフィール設定を行った"
|
||||
|
@ -44,6 +44,7 @@ const ACHIEVEMENT_TYPES = [
|
||||
'loggedInOnNewYearsDay',
|
||||
'noteClipped1',
|
||||
'noteFavorited1',
|
||||
'myNoteFavorited1',
|
||||
'profileFilled',
|
||||
'markedAsCat',
|
||||
'following1',
|
||||
@ -94,7 +95,7 @@ export class AchievementService {
|
||||
@bindThis
|
||||
public async create(
|
||||
userId: User['id'],
|
||||
type: string,
|
||||
type: typeof ACHIEVEMENT_TYPES[number],
|
||||
): Promise<void> {
|
||||
if (!ACHIEVEMENT_TYPES.includes(type)) return;
|
||||
|
||||
|
@ -6,6 +6,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { GetterService } from '@/server/api/GetterService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import { AchievementService } from '@/core/AchievementService.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes', 'favorites'],
|
||||
@ -51,6 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
private idService: IdService,
|
||||
private getterService: GetterService,
|
||||
private achievementService: AchievementService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
// Get favoritee
|
||||
@ -76,6 +78,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
noteId: note.id,
|
||||
userId: me.id,
|
||||
});
|
||||
|
||||
if (note.userHost == null) {
|
||||
this.achievementService.create(note.userId, 'myNoteFavorited1');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ export const ACHIEVEMENT_TYPES = [
|
||||
'loggedInOnNewYearsDay',
|
||||
'noteClipped1',
|
||||
'noteFavorited1',
|
||||
'myNoteFavorited1',
|
||||
'profileFilled',
|
||||
'markedAsCat',
|
||||
'following1',
|
||||
@ -240,6 +241,11 @@ export const ACHIEVEMENT_BADGES = {
|
||||
bg: null,
|
||||
frame: 'bronze',
|
||||
},
|
||||
'myNoteFavorited1': {
|
||||
img: '/fluent-emoji/1f320.png',
|
||||
bg: null,
|
||||
frame: 'silver',
|
||||
},
|
||||
'profileFilled': {
|
||||
img: '/fluent-emoji/1f44c.png',
|
||||
bg: 'linear-gradient(0deg, rgb(187 183 59), rgb(255 143 77))',
|
||||
|
Loading…
Reference in New Issue
Block a user