web: fix anon users resolving to the same robohash

This commit is contained in:
William Casarin 2022-11-14 17:32:08 -08:00
parent 42fd771333
commit 70d0df5240
3 changed files with 6 additions and 4 deletions

View file

@ -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>

View file

@ -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)

View file

@ -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 = "❤️"