From 58156353924f1f4589f0d89644ad9c494bd2e4bd Mon Sep 17 00:00:00 2001 From: Robert Korulczyk Date: Mon, 7 Oct 2024 06:43:05 +0200 Subject: [PATCH] Add `PostUser name` to to `rankings-info` (#104) * Do not use h3 tag for PostUser name. * Restore h3. --- composer.json | 2 +- js/src/forum/addUserInfo.js | 6 +----- js/src/forum/components/RankingsPage.js | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 6c28d51..51edf8f 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ } ], "require": { - "flarum/core": "^1.3.1", + "flarum/core": "^1.7", "fof/extend": "^1.0.0", "ext-json": "*" }, diff --git a/js/src/forum/addUserInfo.js b/js/src/forum/addUserInfo.js index 4d6cfc8..69ff1e1 100644 --- a/js/src/forum/addUserInfo.js +++ b/js/src/forum/addUserInfo.js @@ -11,10 +11,6 @@ export default function () { return (node) => node && node.attrs && node.attrs.className && String(node.attrs.className).split(' ').includes(className); }; - const matchTag = (tagName) => { - return (node) => node && node.tag && node.tag === tagName; - }; - const findMatchClass = function (node, className) { const arr = []; @@ -101,7 +97,7 @@ export default function () { return vnode; } - const header_node = vnode.children.find(matchTag('h3')); + const header_node = vnode.children.find(matchClass('PostUser-name')); const amt = Number(setting('rankAmt')) ?? user.ranks().length; header_node.children = header_node.children diff --git a/js/src/forum/components/RankingsPage.js b/js/src/forum/components/RankingsPage.js index bcab950..f277fe7 100755 --- a/js/src/forum/components/RankingsPage.js +++ b/js/src/forum/components/RankingsPage.js @@ -62,7 +62,7 @@ export default class RankingsPage extends Page { {i < 4 ? : {this.addOrdinalSuffix(i)}}
-

+

{i < 4 ? avatar(user, { className: 'info-avatar rankings-' + i + '-avatar' }) : ''} {username(user)}