mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 05:13:09 +02:00
enhance(backend): use ❤️ for reaction fallback
This commit is contained in:
parent
4edc7d8956
commit
09a846a45c
7 changed files with 16 additions and 20 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
### General
|
### General
|
||||||
- コンディショナルロールの条件に「投稿数が~以下」「投稿数が~以上」を追加
|
- コンディショナルロールの条件に「投稿数が~以下」「投稿数が~以上」を追加
|
||||||
|
- リアクション非対応AP実装からのLikeアクティビティの解釈を👍から♥に
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
- クリップボタンをノートアクションに追加できるように
|
- クリップボタンをノートアクションに追加できるように
|
||||||
|
|
|
@ -594,7 +594,6 @@ tokenRequested: "アカウントへのアクセス許可"
|
||||||
pluginTokenRequestedDescription: "このプラグインはここで設定した権限を行使できるようになります。"
|
pluginTokenRequestedDescription: "このプラグインはここで設定した権限を行使できるようになります。"
|
||||||
notificationType: "通知の種類"
|
notificationType: "通知の種類"
|
||||||
edit: "編集"
|
edit: "編集"
|
||||||
useStarForReactionFallback: "リアクション絵文字が不明な場合、代わりに★を使う"
|
|
||||||
emailServer: "メールサーバー"
|
emailServer: "メールサーバー"
|
||||||
enableEmail: "メール配信機能を有効化する"
|
enableEmail: "メール配信機能を有効化する"
|
||||||
emailConfigInfo: "メールアドレスの確認やパスワードリセットの際に使います"
|
emailConfigInfo: "メールアドレスの確認やパスワードリセットの際に使います"
|
||||||
|
|
11
packages/backend/migration/1679651580149-cleanup.js
Normal file
11
packages/backend/migration/1679651580149-cleanup.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
export class cleanup1679651580149 {
|
||||||
|
name = 'cleanup1679651580149'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "useStarForReactionFallback"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" ADD "useStarForReactionFallback" boolean NOT NULL DEFAULT false`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,8 @@ import { bindThis } from '@/decorators.js';
|
||||||
import { UtilityService } from '@/core/UtilityService.js';
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { UserBlockingService } from '@/core/UserBlockingService.js';
|
import { UserBlockingService } from '@/core/UserBlockingService.js';
|
||||||
|
|
||||||
|
const FALLBACK = '❤';
|
||||||
|
|
||||||
const legacies: Record<string, string> = {
|
const legacies: Record<string, string> = {
|
||||||
'like': '👍',
|
'like': '👍',
|
||||||
'love': '❤', // ここに記述する場合は異体字セレクタを入れない
|
'love': '❤', // ここに記述する場合は異体字セレクタを入れない
|
||||||
|
@ -255,12 +257,6 @@ export class ReactionService {
|
||||||
//#endregion
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
|
||||||
public async getFallbackReaction(): Promise<string> {
|
|
||||||
const meta = await this.metaService.fetch();
|
|
||||||
return meta.useStarForReactionFallback ? '⭐' : '👍';
|
|
||||||
}
|
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public convertLegacyReactions(reactions: Record<string, number>) {
|
public convertLegacyReactions(reactions: Record<string, number>) {
|
||||||
const _reactions = {} as Record<string, number>;
|
const _reactions = {} as Record<string, number>;
|
||||||
|
@ -294,7 +290,7 @@ export class ReactionService {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async toDbReaction(reaction?: string | null, reacterHost?: string | null): Promise<string> {
|
public async toDbReaction(reaction?: string | null, reacterHost?: string | null): Promise<string> {
|
||||||
if (reaction == null) return await this.getFallbackReaction();
|
if (reaction == null) return FALLBACK;
|
||||||
|
|
||||||
reacterHost = this.utilityService.toPunyNullable(reacterHost);
|
reacterHost = this.utilityService.toPunyNullable(reacterHost);
|
||||||
|
|
||||||
|
@ -322,7 +318,7 @@ export class ReactionService {
|
||||||
if (emoji) return reacterHost ? `:${name}@${reacterHost}:` : `:${name}:`;
|
if (emoji) return reacterHost ? `:${name}@${reacterHost}:` : `:${name}:`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.getFallbackReaction();
|
return FALLBACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
|
@ -42,11 +42,6 @@ export class Meta {
|
||||||
})
|
})
|
||||||
public disableRegistration: boolean;
|
public disableRegistration: boolean;
|
||||||
|
|
||||||
@Column('boolean', {
|
|
||||||
default: false,
|
|
||||||
})
|
|
||||||
public useStarForReactionFallback: boolean;
|
|
||||||
|
|
||||||
@Column('varchar', {
|
@Column('varchar', {
|
||||||
length: 1024, array: true, default: '{}',
|
length: 1024, array: true, default: '{}',
|
||||||
})
|
})
|
||||||
|
|
|
@ -303,7 +303,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
enableServiceWorker: instance.enableServiceWorker,
|
enableServiceWorker: instance.enableServiceWorker,
|
||||||
translatorAvailable: instance.deeplAuthKey != null,
|
translatorAvailable: instance.deeplAuthKey != null,
|
||||||
cacheRemoteFiles: instance.cacheRemoteFiles,
|
cacheRemoteFiles: instance.cacheRemoteFiles,
|
||||||
useStarForReactionFallback: instance.useStarForReactionFallback,
|
|
||||||
pinnedUsers: instance.pinnedUsers,
|
pinnedUsers: instance.pinnedUsers,
|
||||||
hiddenTags: instance.hiddenTags,
|
hiddenTags: instance.hiddenTags,
|
||||||
blockedHosts: instance.blockedHosts,
|
blockedHosts: instance.blockedHosts,
|
||||||
|
|
|
@ -17,7 +17,6 @@ export const paramDef = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
disableRegistration: { type: 'boolean', nullable: true },
|
disableRegistration: { type: 'boolean', nullable: true },
|
||||||
useStarForReactionFallback: { type: 'boolean', nullable: true },
|
|
||||||
pinnedUsers: { type: 'array', nullable: true, items: {
|
pinnedUsers: { type: 'array', nullable: true, items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
} },
|
} },
|
||||||
|
@ -115,10 +114,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
set.disableRegistration = ps.disableRegistration;
|
set.disableRegistration = ps.disableRegistration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof ps.useStarForReactionFallback === 'boolean') {
|
|
||||||
set.useStarForReactionFallback = ps.useStarForReactionFallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Array.isArray(ps.pinnedUsers)) {
|
if (Array.isArray(ps.pinnedUsers)) {
|
||||||
set.pinnedUsers = ps.pinnedUsers.filter(Boolean);
|
set.pinnedUsers = ps.pinnedUsers.filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue