nodebb-plugin-onekite-discord 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library.js +7 -4
- package/package.json +1 -1
- package/plugin.json +1 -1
package/library.js
CHANGED
|
@@ -166,7 +166,9 @@ async function buildEmbed({ tid, pid, isReply }) {
|
|
|
166
166
|
const targetUrl = (isReply && pid) ? `${topicUrl}/${pid}` : topicUrl;
|
|
167
167
|
|
|
168
168
|
const baseTitle = decodeHtmlEntities((topicData.title || (isReply ? 'Nouvelle réponse' : 'Nouveau sujet')).toString());
|
|
169
|
-
const
|
|
169
|
+
const isReply = post && post.pid && post.pid !== topic.mainPid;
|
|
170
|
+
const replyIcon = isReply ? '↪️ ' : '';
|
|
171
|
+
const title = categoryName ? `[${categoryName}] ${baseTitle}` : baseTitle;
|
|
170
172
|
const safeTitle = title.slice(0, 256);
|
|
171
173
|
|
|
172
174
|
const excerpt = await getPostExcerpt(isReply ? pid : topicData.mainPid);
|
|
@@ -174,10 +176,11 @@ async function buildEmbed({ tid, pid, isReply }) {
|
|
|
174
176
|
const postForUser = await posts.getPostFields(isReply ? pid : topicData.mainPid, ['uid']);
|
|
175
177
|
const username = await user.getUserField(postForUser.uid, 'username');
|
|
176
178
|
|
|
177
|
-
//
|
|
178
|
-
const
|
|
179
|
+
// Tout le titre dans l'embed : "[Catégorie] Titre - Pseudo" (pseudo sans lien)
|
|
180
|
+
const embedTitle = `${safeTitle} - ${username}`.slice(0, 256);
|
|
179
181
|
|
|
180
|
-
|
|
182
|
+
// Embed title becomes clickable via embed.url
|
|
183
|
+
return { topicData, content: '', embed: { title: embedTitle, url: targetUrl, description: excerpt || '' } };
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
function extractTidPid(data) {
|
package/package.json
CHANGED
package/plugin.json
CHANGED