Node.js based forum software built for the modern web
fix: remove itemprop="image" from buildAvatar
Barış Soner Uşaklıa5ef51037860
diff --git a/install/package.json b/install/package.jsonindex 5f4d5bbe92..692b688c47 100644--- a/install/package.json+++ b/install/package.json@@ -113,10 +113,10 @@"nodebb-plugin-spam-be-gone": "2.3.12","nodebb-plugin-web-push": "0.9.5","nodebb-rewards-essentials": "1.0.3",- "nodebb-theme-harmony": "3.3.4",- "nodebb-theme-lavender": "8.1.0",- "nodebb-theme-peace": "3.1.3",- "nodebb-theme-persona": "15.3.3",+ "nodebb-theme-harmony": "3.3.5",+ "nodebb-theme-lavender": "8.1.1",+ "nodebb-theme-peace": "3.1.4",+ "nodebb-theme-persona": "15.3.4","nodebb-widget-essentials": "8.0.10","nodemailer": "10.0.10","nprogress": "0.2.0",diff --git a/public/src/modules/helpers.common.js b/public/src/modules/helpers.common.jsindex 082fb56079..5374a3c0f1 100644--- a/public/src/modules/helpers.common.js+++ b/public/src/modules/helpers.common.js@@ -417,7 +417,7 @@ module.exports = function (utils, Benchpress, tx, relative_path) {let output = '';if (userObj.picture) {- output += `<img${attr2String(attributes)} alt="${displayname}" loading="lazy" component="${component || 'avatar/picture'}" src="${picture}" style="${style}" onError="this.remove()" itemprop="image" />`;+ output += `<img${attr2String(attributes)} alt="${displayname}" loading="lazy" component="${component || 'avatar/picture'}" src="${picture}" style="${style}" onError="this.remove()" />`;}output += `<span${attr2String(attributes)} component="${component || 'avatar/icon'}" style="${style} background-color: ${iconBgColor}">${iconText}</span>`;return output;diff --git a/src/views/partials/topic/post-meta-tags.tpl b/src/views/partials/topic/post-meta-tags.tplnew file mode 100644index 0000000000..8d0c85d80c--- /dev/null+++ b/src/views/partials/topic/post-meta-tags.tpl@@ -0,0 +1,7 @@+<meta itemprop="datePublished" content="{./timestampISO}">+{{{ if ./editedISO }}}<meta itemprop="dateModified" content="{./editedISO}">{{{ end }}}+<div itemprop="author" itemscope itemtype="https://schema.org/Person">+ <meta itemprop="name" content="{{txDisplayname(./user)}}">+ {{{ if ./user.userslug }}}<meta itemprop="url" content="{config.relative_path}/user/{./user.userslug}">{{{ end }}}+ {{{ if ./user.picture }}}<meta itemprop="image" content="{./user.picture}">{{{ end }}}+</div>\ No newline at end of filediff --git a/test/template-helpers.js b/test/template-helpers.jsindex 1db7244718..d1f1fbe83c 100644--- a/test/template-helpers.js+++ b/test/template-helpers.js@@ -358,7 +358,7 @@ describe('helpers', () => {'icon:bgColor': '#ff0000',};const html = helpers.buildAvatar(user, 32, true);- assert.strictEqual(html, `<img title="john" data-uid="1" class="avatar avatar-rounded" alt="john" loading="lazy" component="avatar/picture" src="/uploads/1.png" style="--avatar-size: 32;" onError="this.remove()" itemprop="image" /><span title="john" data-uid="1" class="avatar avatar-rounded" component="avatar/icon" style="--avatar-size: 32; background-color: #ff0000">J</span>`);+ assert.strictEqual(html, `<img title="john" data-uid="1" class="avatar avatar-rounded" alt="john" loading="lazy" component="avatar/picture" src="/uploads/1.png" style="--avatar-size: 32;" onError="this.remove()" /><span title="john" data-uid="1" class="avatar avatar-rounded" component="avatar/icon" style="--avatar-size: 32; background-color: #ff0000">J</span>`);});it('should escape all attributes', () => {@@ -370,7 +370,7 @@ describe('helpers', () => {'icon:bgColor': '"#ff0000',};const html = helpers.buildAvatar(user, 32, true, '"custom-class', '"component');- assert.strictEqual(html, `<img title=""remoteusername" data-uid=""remoteuid" class="avatar "custom-class avatar-rounded" alt=""remoteusername" loading="lazy" component=""component" src=""/uploads/1.png" style="--avatar-size: 32;" onError="this.remove()" itemprop="image" /><span title=""remoteusername" data-uid=""remoteuid" class="avatar "custom-class avatar-rounded" component=""component" style="--avatar-size: 32; background-color: "#ff0000">"icon</span>`);+ assert.strictEqual(html, `<img title=""remoteusername" data-uid=""remoteuid" class="avatar "custom-class avatar-rounded" alt=""remoteusername" loading="lazy" component=""component" src=""/uploads/1.png" style="--avatar-size: 32;" onError="this.remove()" /><span title=""remoteusername" data-uid=""remoteuid" class="avatar "custom-class avatar-rounded" component=""component" style="--avatar-size: 32; background-color: "#ff0000">"icon</span>`);});});});