Skip to content

Code actions autodetection should not trigger for Top Helpers #719

Closed

Description

@Zabuzard

Motivation

The autodetection of the code-actions feature is supposed to mostly target beginners who do not know how to properly post formatted code yet.

Top Helpers usually always post well formatted and nice looking code, for them the auto-detection is rather annoying.

example

We should adjust our autodetection to ignore messages send by Top Helpers.

Fix

In CodeMessageAutoDetection, we already have code to exit in certain situations:

if (event.isWebhookMessage() || event.getAuthor().isBot() || !isHelpThread(event)) {
  return;
}

...

long amountOfCodeLines = maybeCode.orElseThrow().code().lines().limit(MINIMUM_LINES_OF_CODE).count();
if (amountOfCodeLines < MINIMUM_LINES_OF_CODE) {
  return;
}

We should simply adjust this and add a condition to exist isSendByTopHelper or similar.

To detect Top Helpers, we can either use the existing

"tagManageRolePattern": "Moderator|Community Ambassador|Top Helpers .+",

(it is okay if those other roles are also included then)

or introduce a new config entry.

In any case, we just have to iterate the roles of the author and check if any of them matches that predicate.

Activity

  1. CodePawfect commented on Dec 25, 2022

    @CodePawfect
    Contributor

    I would implement this issue after you assign me to it.

  2. marko-radosavljevic commented on Dec 25, 2022

    @marko-radosavljevic
    Contributor

    Awesome, welcome to the project! ☺️ ❤️

  3. CodePawfect commented on Dec 26, 2022

    @CodePawfect
    Contributor

    I created a pull request for the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issuehelp wantedpriority: normal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions