Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting of 'topic changed' for the channelUpdate event log is inconsistent #406

Open
rasmusgerdin opened this issue Oct 13, 2021 · 0 comments
Labels
Bug: Confirmed Issues that report confirmed bugs. Meta: Bugfix PRs that fix bugs or issues. Priority: Low Issues that must be fixed or PRs that must be finished and merged with low priority. Type: Maintenance Issues and PRs related to the maintenance of a feature or function.

Comments

@rasmusgerdin
Copy link
Member

Describe the bug
The formatting of the 'topic changed' entry for the channelUpdate event log is inconsistent depending on what the topic is set to. When no topic exists and one is set, or when you unset the topic, it's formatted as if the string length exceeds 64 characters despite there effectively being 0 characters.

To Reproduce
Steps to reproduce the behavior:

  1. Set or unset the topic for a channel while having the channelUpdate event log enabled for the guild.

Expected behavior
If either the old or new topic string length exceeds 64 characters, the entry should be formatted for long strings (i.e. the Events.Guilds.Logs.ChangeLongText language string). If both the old or new topic string lengths are under 64 characters (including if they are unset, meaning 0 characters), the entry should be formatted for short strings (i.e. the Events.Guilds.Logs.ChangeShortText language string).

Screenshots
Long string formatting applied correctly.
image

Short string formatting applied correctly.
image

Long string formatting incorrectly applied when topic length is 0 characters long.
image

Additional context
Relevant code snippet.

if (oldChannel.topic !== channel.topic) {
embed.addField(t(LanguageKeys.Events.Guilds.Logs.TopicChanged),
(oldChannel.topic?.length as number < 64 && channel.topic?.length as number < 64) ?
t(LanguageKeys.Events.Guilds.Logs.ChangeShortText, { before: oldChannel.topic, after: channel.topic }) :
t(LanguageKeys.Events.Guilds.Logs.ChangeLongText, {
before: oldChannel.topic?.length ? cutText(oldChannel.topic as string, 496) : t(LanguageKeys.Globals.None),
after: channel.topic?.length ? cutText(channel.topic as string, 496) : t(LanguageKeys.Globals.None)
})
);
}

@rasmusgerdin rasmusgerdin added Bug: Confirmed Issues that report confirmed bugs. Priority: Low Issues that must be fixed or PRs that must be finished and merged with low priority. Meta: Bugfix PRs that fix bugs or issues. Type: Maintenance Issues and PRs related to the maintenance of a feature or function. labels Oct 13, 2021
@rasmusgerdin rasmusgerdin added this to To-do in The RTByte Project via automation Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Confirmed Issues that report confirmed bugs. Meta: Bugfix PRs that fix bugs or issues. Priority: Low Issues that must be fixed or PRs that must be finished and merged with low priority. Type: Maintenance Issues and PRs related to the maintenance of a feature or function.
Projects
Development

No branches or pull requests

1 participant