nodebb-theme-persona 14.0.15 → 14.0.16
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/package.json
CHANGED
|
@@ -19,7 +19,7 @@ define('persona/mobile-menu', [
|
|
|
19
19
|
if (!menuEl || !chatsMenuEl) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
const chatMenuVisible = app.user &&
|
|
22
|
+
const chatMenuVisible = app.user && app.user.userslug;
|
|
23
23
|
let swapped = !!Storage.getItem('persona:menus:legacy-layout');
|
|
24
24
|
const margin = window.innerWidth;
|
|
25
25
|
|
|
@@ -118,7 +118,7 @@ define('persona/mobile-menu', [
|
|
|
118
118
|
$('#user-control-list').children().clone(true, true).appendTo($('#chats-menu [data-section="profile"] ul'));
|
|
119
119
|
|
|
120
120
|
socket.on('event:user_status_change', function (data) {
|
|
121
|
-
if (
|
|
121
|
+
if (String(data.uid) === String(app.user.uid)) {
|
|
122
122
|
app.updateUserStatus($('#chats-menu [component="user/status"]'), data.status);
|
|
123
123
|
navSlideout.close();
|
|
124
124
|
}
|
package/public/persona.js
CHANGED
|
@@ -166,35 +166,30 @@ $(document).ready(function () {
|
|
|
166
166
|
function generateUserCard(ev) {
|
|
167
167
|
var avatar = $(this);
|
|
168
168
|
var uid = avatar.parents('[data-uid]').attr('data-uid');
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (parseInt(data[i].uid, 10) === parseInt(uid, 10)) {
|
|
173
|
-
data = data[i].user;
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
169
|
+
const topicOrPost = (ajaxify.data.topics || ajaxify.data.posts || []).find(d => String(d.uid) === String(uid));
|
|
170
|
+
if (!topicOrPost) return;
|
|
171
|
+
const user = topicOrPost.user;
|
|
177
172
|
|
|
178
173
|
$('.persona-usercard').remove();
|
|
179
174
|
|
|
180
|
-
if (
|
|
175
|
+
if (!user.userslug) {
|
|
181
176
|
return false;
|
|
182
177
|
}
|
|
183
178
|
|
|
184
|
-
socket.emit('user.isFollowing', { uid:
|
|
179
|
+
socket.emit('user.isFollowing', { uid: user.uid }, function (err, isFollowing) {
|
|
185
180
|
if (err) {
|
|
186
181
|
return err;
|
|
187
182
|
}
|
|
188
183
|
|
|
189
|
-
app.parseAndTranslate('modules/usercard',
|
|
184
|
+
app.parseAndTranslate('modules/usercard', user, function (html) {
|
|
190
185
|
var card = $(html);
|
|
191
186
|
avatar.parents('a').after(card.hide());
|
|
192
187
|
|
|
193
|
-
if (
|
|
188
|
+
if (String(app.user.uid) === String(user.uid) || !app.user.uid) {
|
|
194
189
|
card.find('.btn-morph').hide();
|
|
195
190
|
} else {
|
|
196
|
-
const uid = isFinite(
|
|
197
|
-
setupFavouriteMorph(card, uid,
|
|
191
|
+
const uid = isFinite(user.uid) ? user.uid : encodeURIComponent(user.userslug);
|
|
192
|
+
setupFavouriteMorph(card, uid, user.username);
|
|
198
193
|
|
|
199
194
|
if (isFollowing) {
|
|
200
195
|
$('.btn-morph').addClass('heart');
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
{function.buildCategoryLabel, ./category, "a", "border"}
|
|
55
55
|
{{{ end }}}
|
|
56
56
|
|
|
57
|
-
<span data-tid="{./tid}" component="topic/tags" class="lh-1 tag-list
|
|
57
|
+
<span data-tid="{./tid}" component="topic/tags" class="lh-1 tag-list d-flex flex-wrap gap-1 {{{ if !./tags.length }}}hidden{{{ end }}}">
|
|
58
58
|
{{{ each ./tags }}}
|
|
59
59
|
<a href="{config.relative_path}/tags/{./valueEncoded}"><span class="badge border border-gray-300 fw-normal tag tag-class-{./class}" data-tag="{./value}">{./valueEscaped}</span></a>
|
|
60
60
|
{{{ end }}}
|