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

Split log line generation from message search text #4742

Merged
merged 4 commits into from Aug 5, 2023

Conversation

Mm2PL
Copy link
Collaborator

@Mm2PL Mm2PL commented Aug 1, 2023

Description

Closes #4697

The line string is now generated in logging code and search text isn't used.

@Mm2PL Mm2PL requested a review from pajlada August 1, 2023 18:34
@Felanbird Felanbird added this to the 2.4.5 milestone Aug 3, 2023
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@Felanbird Felanbird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@pajlada
Copy link
Member

pajlada commented Aug 5, 2023

This still generates duplicate usernames in logs

Without this PR:

[13:32:06] pajlada  pajlada: xd
[13:32:19] pieladder  pajlada: xbcvbcvb

With this PR:

[13:28:44] pajlada  pajlada: b
[13:29:02] pieladder  pajlada: c

Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected

After this PR:

[13:49:58] pajlada: asd << without nickname
[13:50:00] 테스트계정420 testaccount_420: xd
[13:50:18] pajlada: xddddd << with nickname

@pajlada pajlada enabled auto-merge August 5, 2023 11:51
@pajlada
Copy link
Member

pajlada commented Aug 5, 2023

@Mm2PL has mentioned that this will make a change in how usernames are logged; the previous way was to have two spaces if no localized username was found, this PR changes this with my additional commits

@pajlada pajlada disabled auto-merge August 5, 2023 12:49
@pajlada pajlada enabled auto-merge August 5, 2023 12:49
@pajlada pajlada added this pull request to the merge queue Aug 5, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

if ((message->flags.has(MessageFlag::ReplyMessage) &&
getSettings()->stripReplyMention) &&
!getSettings()->hideReplyContext)
{
qsizetype colonIndex = messageSearchText.indexOf(':');
qsizetype colonIndex = messageText.indexOf(':');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'colonIndex' of type 'qsizetype' (aka 'long long') can be declared 'const' [misc-const-correctness]

Suggested change
qsizetype colonIndex = messageText.indexOf(':');
qsizetype const colonIndex = messageText.indexOf(':');

if (colonIndex != -1)
{
QString rootMessageChatter =
message->replyThread->root()->loginName;
messageSearchText.insert(colonIndex + 1, " @" + rootMessageChatter);
messageText.insert(colonIndex + 1, " @" + rootMessageChatter);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from 'long long' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

            messageText.insert(colonIndex + 1, " @" + rootMessageChatter);
                               ^

Merged via the queue into master with commit e13df1f Aug 5, 2023
15 of 16 checks passed
@pajlada pajlada deleted the bugfix/restore_logs_to_pre_4663 branch August 5, 2023 13:56
Nerixyz pushed a commit to Nerixyz/chatterino2 that referenced this pull request Aug 12, 2023
* Split log line generation from message search text

* changelog

* remove empty space at the beginning of usernames

* Move changelog entry

---------

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
Nerixyz pushed a commit to Nerixyz/chatterino2 that referenced this pull request Aug 19, 2023
* Split log line generation from message search text

* changelog

* remove empty space at the beginning of usernames

* Move changelog entry

---------

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Usernames without nicknames in logs are duplicated
3 participants