Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pkg/notify/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,15 @@ func TestFormatNextActionsInternal(t *testing.T) {
nextActions: map[string]turn.Action{
"user1": {Kind: turn.ActionReview},
},
expected: "review: @user1",
expected: "*review* → @user1",
},
{
name: "multiple users same action",
nextActions: map[string]turn.Action{
"user1": {Kind: turn.ActionReview},
"user2": {Kind: turn.ActionReview},
},
expected: "review: @user1, @user2",
expected: "*review* → @user1, @user2",
},
{
name: "system user filtered out",
Expand All @@ -316,7 +316,7 @@ func TestFormatNextActionsInternal(t *testing.T) {
"_system": {Kind: turn.ActionReview},
"user1": {Kind: turn.ActionReview},
},
expected: "review: @user1",
expected: "*review* → @user1",
},
}

Expand Down Expand Up @@ -650,7 +650,7 @@ func TestFormatNextActionsSuffixWithActions(t *testing.T) {
Domain: "example.com",
UserMapper: mapper,
},
expected: " review: @user1",
expected: " • *review* → @user1",
},
{
name: "suffix with multiple users",
Expand All @@ -667,7 +667,7 @@ func TestFormatNextActionsSuffixWithActions(t *testing.T) {
Domain: "example.com",
UserMapper: mapper,
},
expected: " review: ",
expected: " • *review* → ",
},
{
name: "suffix filters system user",
Expand All @@ -683,7 +683,7 @@ func TestFormatNextActionsSuffixWithActions(t *testing.T) {
Domain: "example.com",
UserMapper: mapper,
},
expected: " review",
expected: " review",
},
}

Expand All @@ -693,8 +693,8 @@ func TestFormatNextActionsSuffixWithActions(t *testing.T) {
// For tests with multiple users, just check that result starts with the prefix
// since map iteration order is not guaranteed
if tt.name == "suffix with multiple users" {
if !contains(result, " review: ") {
t.Errorf("expected result to contain \" review: \", got: %q", result)
if !contains(result, " • *review* → ") {
t.Errorf("expected result to contain \" • *review* → \", got: %q", result)
}
} else if result != tt.expected {
t.Errorf("expected %q, got %q", tt.expected, result)
Expand Down
8 changes: 4 additions & 4 deletions pkg/notify/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func FormatNextActionsSuffix(ctx context.Context, params MessageParams) string {

actions := formatNextActionsInternal(ctx, params.CheckResult.Analysis.NextAction, params.Owner, params.Domain, params.UserMapper)
if actions != "" {
return fmt.Sprintf(" %s", actions)
return fmt.Sprintf(" %s", actions)
}
return ""
}
Expand Down Expand Up @@ -272,10 +272,10 @@ func formatNextActionsInternal(ctx context.Context, nextActions map[string]turn.
// Format user mentions (will be empty if only _system was assigned)
userMentions := userMapper.FormatUserMentions(ctx, users, owner, domain)

// If action has users, format as "action: users"
// If no users (was only _system), just show the action
// If action has users, format as "*action* → users" (bold action when assigned to person)
// If no users (was only _system), just show the action without bold
if userMentions != "" {
parts = append(parts, fmt.Sprintf("%s: %s", actionName, userMentions))
parts = append(parts, fmt.Sprintf("*%s* → %s", actionName, userMentions))
} else {
parts = append(parts, actionName)
}
Expand Down
Loading