Fixed comma appended to username completion when not at the beginning of the message (#3060)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Paweł
2021-07-24 12:01:50 +02:00
committed by GitHub
parent ae9f92ded9
commit 588ed557f0
13 changed files with 97 additions and 22 deletions
+13
View File
@@ -68,4 +68,17 @@ QColor getRandomColor(const QString &userId)
return TWITCH_USERNAME_COLORS[colorIndex];
}
QString formatUserMention(const QString &userName, bool isFirstWord,
bool mentionUsersWithComma)
{
QString result = userName;
if (isFirstWord && mentionUsersWithComma)
{
result += ",";
}
return result;
}
} // namespace chatterino
+10
View File
@@ -20,4 +20,14 @@ QString kFormatNumbers(const int &number);
QColor getRandomColor(const QString &userId);
/**
* @brief Takes a user's name and some formatting parameter and spits out the standardized way to format it
*
* @param userName a user's name
* @param isFirstWord signifies whether this mention would be the first word in a message
* @param mentionUsersWithComma postfix mentions with a comma. generally powered by getSettings()->mentionUsersWithComma
**/
QString formatUserMention(const QString &userName, bool isFirstWord,
bool mentionUsersWithComma);
} // namespace chatterino