Skip to content

Code actions autodetection should not trigger for Top Helpers #719

@Zabuzard

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions