fix: retirer la mention initiale des commentaires importés
This commit is contained in:
@@ -6,6 +6,12 @@ function stripHtml(html) {
|
||||
return (html || '').replace(/<[^>]*>/g, '').trim();
|
||||
}
|
||||
|
||||
// Mastodon préfixe toujours une réponse par la mention du compte cité,
|
||||
// déjà visible via l'avatar/le nom : redondant à l'affichage.
|
||||
function stripMentionsInisyal(texte) {
|
||||
return texte.replace(/^(@\S+\s*)+/, '').trim();
|
||||
}
|
||||
|
||||
async function importBokanteComments({strapi}) {
|
||||
const paroles = await strapi.db.query('api::parole.parole').findMany({
|
||||
where: {bokanteStatusId: {$notNull: true}}
|
||||
@@ -39,7 +45,7 @@ async function importBokanteComments({strapi}) {
|
||||
const commentaire = await strapi.documents('api::commentaire.commentaire').create({
|
||||
status: 'published',
|
||||
data: {
|
||||
contenu: stripHtml(status.content),
|
||||
contenu: stripMentionsInisyal(stripHtml(status.content)),
|
||||
datePublication: status.created_at,
|
||||
origine: 'activitypub',
|
||||
auteurNom: status.account?.display_name,
|
||||
|
||||
Reference in New Issue
Block a user