mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-01-01 00:40:43 +01:00
デフォルトハッシュタグタイムライン
This commit is contained in:
parent
de32e55ee4
commit
bc3899f56f
5 changed files with 18 additions and 11 deletions
|
@ -59,7 +59,6 @@ import { UtilityService } from '@/core/UtilityService.js';
|
|||
import { UserBlockingService } from '@/core/UserBlockingService.js';
|
||||
import { isReply } from '@/misc/is-reply.js';
|
||||
import { trackPromise } from '@/misc/promise-tracker.js';
|
||||
import { loadConfig } from '@/config.js';
|
||||
|
||||
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
|
||||
|
||||
|
@ -321,6 +320,16 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
data.localOnly = true;
|
||||
}
|
||||
|
||||
// デフォルトハッシュタグ処理
|
||||
if (['public', 'home'].includes(data.visibility)) {
|
||||
if (this.config.tagging.defaultTag != null) {
|
||||
const tag = `#${this.config.tagging.defaultTag}`;
|
||||
if (String(data.text).match(tag)) {
|
||||
data.text = `${data.text}\n\n${tag}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.text) {
|
||||
if (data.text.length > DB_MAX_NOTE_TEXT_LENGTH) {
|
||||
data.text = data.text.slice(0, DB_MAX_NOTE_TEXT_LENGTH);
|
||||
|
@ -915,11 +924,9 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
// デフォルトハッシュタグ
|
||||
const config = loadConfig();
|
||||
let defaultTag:string | null = config.tagging.defaultTag;
|
||||
if (defaultTag != null) {
|
||||
if (this.config.tagging.defaultTag != null) {
|
||||
const noteTags = note.tags ? note.tags.map((t: string) => t.toLowerCase()) : [];
|
||||
if (note.visibility === 'public' && noteTags.includes(normalizeForSearch(defaultTag))) {
|
||||
if (note.visibility === 'public' && noteTags.includes(normalizeForSearch(this.config.tagging.defaultTag))) {
|
||||
this.fanoutTimelineService.push('localTimelineWithReplies', note.id, 300, r);
|
||||
this.fanoutTimelineService.push('localTimeline', note.id, 1000, r);
|
||||
if (note.fileIds.length > 0) {
|
||||
|
|
|
@ -201,7 +201,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
|
||||
const config = loadConfig();
|
||||
let defaultTag:string | null = config.tagging.defaultTag;
|
||||
const defaultTag: string | null = config.tagging.defaultTag;
|
||||
if (defaultTag == null) {
|
||||
qb.orWhere('(note.visibility = \'public\') AND (note.userHost IS NULL)');
|
||||
} else {
|
||||
|
|
|
@ -152,7 +152,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
withReplies: boolean,
|
||||
}, me: MiLocalUser | null) {
|
||||
const config = loadConfig();
|
||||
let defaultTag:string | null = config.tagging.defaultTag;
|
||||
const defaultTag: string | null = config.tagging.defaultTag;
|
||||
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'),
|
||||
ps.sinceId, ps.untilId)
|
||||
.andWhere(new Brackets(qb => {
|
||||
|
|
|
@ -24,7 +24,7 @@ class HybridTimelineChannel extends Channel {
|
|||
private withRenotes: boolean;
|
||||
private withReplies: boolean;
|
||||
private withFiles: boolean;
|
||||
private defaultTag: string;
|
||||
private defaultTag: string | null;
|
||||
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
|
@ -47,7 +47,7 @@ class HybridTimelineChannel extends Channel {
|
|||
this.withReplies = params.withReplies ?? false;
|
||||
this.withFiles = params.withFiles ?? false;
|
||||
const config = loadConfig();
|
||||
this.defaultTag = config.tagging.defaultTag;
|
||||
this.defaultTag = config.tagging.defaultTag;
|
||||
|
||||
// Subscribe events
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
|
|
|
@ -22,7 +22,7 @@ class LocalTimelineChannel extends Channel {
|
|||
private withRenotes: boolean;
|
||||
private withReplies: boolean;
|
||||
private withFiles: boolean;
|
||||
private defaultTag: string;
|
||||
private defaultTag: string | null;
|
||||
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
|
@ -45,7 +45,7 @@ class LocalTimelineChannel extends Channel {
|
|||
this.withReplies = params.withReplies ?? false;
|
||||
this.withFiles = params.withFiles ?? false;
|
||||
const config = loadConfig();
|
||||
this.defaultTag = config.tagging.defaultTag;
|
||||
this.defaultTag = config.tagging.defaultTag;
|
||||
|
||||
// Subscribe events
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
|
|
Loading…
Reference in a new issue