Habitica: Contributor titles don't show in full on hover over player's name

Created on 19 Aug 2018  路  7Comments  路  Source: HabitRPG/habitica

When you hover over a contributor's name in chat, you should see, for example, "Friend Socialite". Currently you just see "Socialite". The tier types are "Friend", "Elite", "Champion", Legendary", "Guardian", "Heroic". You can see code related to them here:
https://github.com/HabitRPG/habitica/blob/1eb1fe76a8917cf5cd67d317fb91f577e7470d51/website/common/script/libs/achievements.js#L9-L32

And in fact that function might be useful for fixing this bug although I don't guarantee that since I haven't looked into it in detail. :)

For cases where the contributor has more than one tier type, you should see, for example, "Elite Socialte, Comrade" (i.e., the "Friend"/"Elite"/etc portion doesn't need to be repeated for each tier type.

medium Tavern Chat status in progress medium level coding

All 7 comments

@Alys

Hello,
Could I investigate this problem?
Thank you :)
Max

@legitmaxwu please do, thanks! Comment here if your have questions.

@Alys contribText()is used solely for printing the achievements panel in the user profile modal, as shown here: (don't mind the title I put)
image
This means that it isn't used when generating the name tooltip (and in the Hall of Heroes). To have it append the title prefixes everywhere (player-name tooltip & hall of heroes page), there are two approaches:

1) call the contribText() function every single time the title is requested. (during ChatCard creation and when generating the Hall of Heroes)
2) modify the code so that contribText() directly edits user.contributor.text (which stores the contributor title) so we don't have to call contribText() every time user.contributor.text is used. The only potential unwanted side-effect of this is that the Hall of Heroes will have prefixes, which is kind of redundant because contributor tiers are also displayed in the table.

Any ideas on how I should proceed?

Currently, I added a function to achievements.js that is able to export whatever contribText() returns. It can be called from any file to update user.contributor.text. It looks like this:

achievs.updateContribText = function updateContribText (user, language) {
  let result = contribText(user.contributor, user.backer, language);
  return result;
};

It's not much, but learning JavaScript and familiarizing with Vue and digging through the code and figuring out how to debug has been quite the journey haha. I know some parts of my explanation might not be clear, so please let me know if you need any clarification.

@legitmaxwu Thanks for looking into this! Out of your two options, 1 would be the best. We don't want the title stored in user.contributor.text because it would have implications for translations and for updating the contributor details when the tier changes. However you might like to wait a day or two in case the staff chime in with other suggestions.

I like Legendary lolol :)

Thanks for the feedback! I will continue investigating tomorrow. I never thought about translations factoring in here鈥攖hat鈥檚 a very good point! I will proceed with option 1 unless anyone has more input.

Is anyone who is more familiar with the code aware of where the code that loads user info into the chat card is? I鈥檝e been searching but haven鈥檛 quite found it.

I think what you will want to do is create a computed property (Vue thing) inside of chatCard.vue (I think) that returns the users title. No need to modify the user directly or use that function since it returns the wrong text.

@TheHollidayInn Thanks for the tip! I'll try that now.

Was this page helpful?
0 / 5 - 0 ratings