mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-01 16:28:06 +09:00
Add parsing of host, fix usernames
This commit is contained in:
parent
6c7cf90c5b
commit
e23ca84925
@ -3,6 +3,7 @@ import { dbLogger } from "./logger.js";
|
|||||||
|
|
||||||
import config from "@/config/index.js";
|
import config from "@/config/index.js";
|
||||||
import {Note} from "@/models/entities/note.js";
|
import {Note} from "@/models/entities/note.js";
|
||||||
|
import * as url from "url";
|
||||||
|
|
||||||
const logger = dbLogger.createSubLogger("meilisearch", "gray", false);
|
const logger = dbLogger.createSubLogger("meilisearch", "gray", false);
|
||||||
|
|
||||||
@ -121,14 +122,14 @@ export default hasConfig ? {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
indexingBatch.push({
|
indexingBatch.push(<MeilisearchNote>{
|
||||||
id: note.id.toString(),
|
id: note.id.toString(),
|
||||||
text: note.text ? note.text : "",
|
text: note.text ? note.text : "",
|
||||||
userId: note.userId,
|
userId: note.userId,
|
||||||
userHost: note.userHost ? note.userHost : "",
|
userHost: note.userHost !== "" ? note.userHost : url.parse(config.host).host,
|
||||||
channelId: note.channelId ? note.channelId : "",
|
channelId: note.channelId ? note.channelId : "",
|
||||||
mediaAttachment: attachmentType,
|
mediaAttachment: attachmentType,
|
||||||
userName: note.user?.username ? note.user.username : "",
|
userName: note.user?.usernameLower ?? "UNKNOWN",
|
||||||
createdAt: note.createdAt.getTime() / 1000 // division by 1000 is necessary because Node returns in ms-accuracy
|
createdAt: note.createdAt.getTime() / 1000 // division by 1000 is necessary because Node returns in ms-accuracy
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user