openvibers/openvibe.network Commits

A live card names the channel by its @handle (#777)

OP OpenVibers committed 3 days ago · 72383e4ad1 · 2 files, +2 −2

The home's Right now live cards open /@username but showed a bare display name. The name is now the username's @handle, as its address is.

Changes

ddiff --git a/server/home/activity.js b/server/home/activity.js
iindex 11230025..53a7edce 100644
---- a/server/home/activity.js
++++ b/server/home/activity.js
@@@ -57,7 +57,7 @@ function liveRows(body) {
function liveStreams(body) {
return liveRows(body)
.map((s) => ({
-- name: clip(s.display_name || s.username, 40),
++ name: '@' + clip(s.username, 39),
title: clip(s.ai_title || s.title || `${s.username} is live`, 90),
url: `${PUBLIC.live}/@${encodeURIComponent(s.username)}`,
thumb: abs(PUBLIC.live, s.thumbnail_url),
ddiff --git a/test/home-front-door.test.js b/test/home-front-door.test.js
iindex 86163724..8a111b67 100644
---- a/test/home-front-door.test.js
++++ b/test/home-front-door.test.js
@@@ -17,7 +17,7 @@ const live = activity.liveStreams({ streams: [
{ is_live: 0, username: 'offline', title: 'ended' },
{ is_live: 1, is_nsfw: 0, username: 'bob', title: 'Big stream', thumbnail_url: 'javascript:alert(1)', total_viewer_count: 1200 },
] });
--assert.deepStrictEqual(live.map((s) => s.name), ['bob', 'Alice'], 'live and SFW only, most watched first');
++assert.deepStrictEqual(live.map((s) => s.name), ['@bob', '@alice'], 'live and SFW only, most watched first, named by @handle');
assert.strictEqual(live[1].thumb, 'https://openvibe.live/api/thumbnails/a.jpg', 'a relative thumbnail becomes the public https URL');
assert.strictEqual(live[0].thumb, null, 'a non-https thumbnail is dropped');
assert.strictEqual(live[1].url, 'https://openvibe.live/@alice');