jolly-roger icon indicating copy to clipboard operation
jolly-roger copied to clipboard

allow hunters to change profile image

Open climatebrad opened this issue 3 years ago • 7 comments

Profile image seems to be coded to Google account. Would love to be able to upload a different image (that actually has my face).

climatebrad avatar Jan 26 '23 18:01 climatebrad

Hmm. DIscord these days does support per-server avatars, although we're not currently able to take advantage of them (#1312). Rather than adding an additional mechanism for setting/storing avatars, I think my preferred solution would be to fix support for per-server avatars and then just encourage people to change their avatar within the associated server. Does that seem like a reasonable solution (potentially with, say, a tooltip on the profile page telling you that that's how to change the avatar)?

ebroder avatar Jan 26 '23 20:01 ebroder

That makes sense

climatebrad avatar Jan 27 '23 03:01 climatebrad

(We're not actually using the Discord integration at all, but... we aren't a use case you should prioritize!)

https://github.com/aubilenon was trying to set an emoji as the first character of his name so it would show up in the bubble instead of a first initial, but that didn't work out (either the first-initialing is byte-wise, or the rendering can't deal with emoji)

egnor avatar Jan 08 '24 07:01 egnor

Oh boy. Well, this is the relevant line of code: https://github.com/deathandmayhem/jolly-roger/blob/218c0be267be6dc927e2fd1d82eed9bc41b55a19/imports/client/components/Avatar.tsx#L51

String.prototype.slice claims to take some number of "characters" from the string, and it does seem to work for me for emojis that are in the Basic Multilingual Plane (like ✅ ) but not ones in the astral plane (e.g. 🤝) or ones which are multiple-codepoints ZWJ'd together (🏴‍☠️). I...have no idea what the right line of code is that pulls a single rendered glyph but I would sign off on a patch? 😄

ebroder avatar Jan 08 '24 07:01 ebroder

I, uh, guess that maybe at some point in the future we could use [...new Intl.Segmenter('en').segment(displayName)][0] but Firefox only supports that in nightlies.

ebroder avatar Jan 08 '24 07:01 ebroder

To address a little confusion, we currently use Discord avatars, not Google. (From what I recall, using Google avatars would be straightforward but requires a permission we don’t currently request.)

Regarding grapheme segmentation: This issue also arose in answer respacing, where we settled on Intl.Segmenter with a fallback to naive indexing. In the long term, this is the answer, but if I’d realized Firefox support was going to take so long, I’d have found a better fallback…

https://github.com/deathandmayhem/jolly-roger/blob/3f112044cf83002a58e8dcf18e4f56c2429c98b6/imports/client/components/PuzzleAnswer.tsx#L71-L81

Polyfills are available, though their correctness and completeness are unclear. We’re only concerned with segmenting graphemes and have some tolerance for error (since respacing is strictly optional), so a mostly correct implementation is probably fine. A hastily made plane and ZWJ aware segmenter would be sufficient in practice, or at least better than the current fallback.

Arguably, we shouldn’t be encouraging use of emojis in display names, which sacrifices clarity for something that could be achieved with an avatar, but we’ll never stop users from trying things like that.

grantaelliott avatar Jan 08 '24 13:01 grantaelliott

Per-server avatars in Discord are locked behind Nitro, from what I can tell. I feel like you shouldn't have to pay to set a custom avatar that's different from your global one on Discord.

Does that change your opinion on whether JR should allow customizing them?

jpd236 avatar May 25 '24 05:05 jpd236