commit 70d0df5240a02bd0045ec6d57a8428bdf5b74567
parent 42fd771333423d78f31657b7c4f2a10760b3cdb7
Author: William Casarin <jb55@jb55.com>
Date: Mon, 14 Nov 2022 17:32:08 -0800
web: fix anon users resolving to the same robohash
Diffstat:
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/web/index.html b/web/index.html
@@ -8,11 +8,11 @@
<link rel="stylesheet" href="css/responsive.css?v=8">
<link rel="stylesheet" href="css/fontawesome.css?v=2">
<script defer src="js/ui/util.js?v=5"></script>
- <script defer src="js/ui/render.js?v=5"></script>
+ <script defer src="js/ui/render.js?v=6"></script>
<script defer src="js/noble-secp256k1.js?v=1"></script>
<script defer src="js/bech32.js?v=1"></script>
<script defer src="js/nostr.js?v=6"></script>
- <script defer src="js/damus.js?v=77"></script>
+ <script defer src="js/damus.js?v=78"></script>
</head>
<body>
<script>
diff --git a/web/js/damus.js b/web/js/damus.js
@@ -1283,6 +1283,8 @@ function robohash(pk) {
}
function get_picture(pk, profile) {
+ if (!profile)
+ return robohash(pk)
if (profile.resolved_picture)
return profile.resolved_picture
profile.resolved_picture = sanitize(profile.picture) || robohash(pk)
diff --git a/web/js/ui/render.js b/web/js/ui/render.js
@@ -162,7 +162,7 @@ function render_event(damus, view, ev, opts={}) {
view.rendered.add(ev.id)
- const profile = damus.profiles[ev.pubkey] || DEFAULT_PROFILE
+ const profile = damus.profiles[ev.pubkey]
const delta = time_delta(new Date().getTime(), ev.created_at*1000)
const has_bot_line = opts.is_reply
@@ -229,7 +229,7 @@ function render_reaction_group(model, emoji, reactions, reacting_to) {
}
function render_reaction(model, reaction) {
- const profile = model.profiles[reaction.pubkey] || DEFAULT_PROFILE
+ const profile = model.profiles[reaction.pubkey]
let emoji = reaction.content[0]
if (reaction.content === "+" || reaction.content === "")
emoji = "❤️"