⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@JOAO-Ethan
Copy link

Summary

Added a collapsed style for labeled issue notifications.

Ticket Link

Fixes #740

@JOAO-Ethan JOAO-Ethan requested a review from a team as a code owner December 14, 2025 17:06
@mattermost-build
Copy link
Contributor

Hello @JOAO-Ethan,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@marianunez marianunez requested a review from Copilot December 14, 2025 17:09
@marianunez marianunez added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Dec 14, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a collapsed notification style for GitHub issue labeled events. When the collapsed style is configured, issue labeled notifications display in a more compact format instead of the default expanded format with title and multiple lines.

Key Changes:

  • Modified the issueLabelled template to support both collapsed and expanded notification styles
Comments suppressed due to low confidence (2)

server/plugin/template.go:1

  • There are two spaces between the closing backtick and 'by'. This should be reduced to one space for consistent spacing.
// Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved.

server/plugin/template.go:1

  • The word 'issue-labeled' uses a hyphen while line 311 uses 'labeled' without 'issue-' prefix. Consider using consistent terminology across both style variants (either 'labeled' or 'issue-labeled' in both places) for better maintainability.
// Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@nevyangelova nevyangelova left a comment

Choose a reason for hiding this comment

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

Thanks @JOAO-Ethan looks good to me. Note for QA:

  1. Create a subscription with --render-style collapsed /github subscribe owner/repo issues --render-style collapsed
  2. Label an issue in GitHub
  3. Verify the notification in Mattermost is a single line like:

owner/repo issue #123 labeled bug by @username.

  1. Then repeat with expanded style /github subscribe owner/repo issues --render-style expanded
  2. Verify the notification shows heading format:

Issue Title

owner/repo#123

#issue-labeled enhancement by @username.

@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

Copy link
Contributor

@avasconcelos114 avasconcelos114 left a comment

Choose a reason for hiding this comment

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

Hello! Apologies in the delay providing feedback on your PR, and great job in making sure we can have the collapsed style also present in these notifications :)

I think we'll just want the TestIssueLabelledTemplate test in template_test.go edited to also include a test case for when we are passing the collapsed config, there are other tests in the same file that you can reference to accomplish that

Thank you for your contribution and let me know if you have any questions 🙌

Copy link
Contributor

@avasconcelos114 avasconcelos114 left a comment

Choose a reason for hiding this comment

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

Superb! Thank you for following up so quickly 🥳
Everything looks great now

@avasconcelos114 avasconcelos114 requested a review from ogi-m January 29, 2026 15:39
@avasconcelos114 avasconcelos114 removed the 2: Dev Review Requires review by a core committer label Jan 29, 2026
@avasconcelos114
Copy link
Contributor

@JOAO-Ethan Ahh seems there are some lingering issues with the tests, would you please look into them and tag me again once done for a final check? 🙏

Thank you!

@JOAO-Ethan
Copy link
Author

@avasconcelos114 I think it's good ? Tbh I don't really understand why sometimes it wont accept the newline characters ^^'

@JOAO-Ethan
Copy link
Author

Hope it's good now

template.Must(masterTemplate.New("issueLabelled").Funcs(funcMap).Parse(`
{{ if eq .Config.Style "collapsed" -}}
{{template "repo" .Event.GetRepo}} issue {{template "issue" .Event.GetIssue}} labeled ` + "`{{.Event.GetLabel.GetName}}`" + ` by {{template "user" .Event.GetSender}}.
{{- else }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I ran a quick check in my local environment (you can run make test to run the same tests that are running in the pipeline prior to pushing your changes) and the only bit you're missing for the template and tests to work properly is a hyphen in this section

Suggested change
{{- else }}
{{- else -}}

Copy link
Author

Choose a reason for hiding this comment

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

oh thanks !

Copy link
Author

Choose a reason for hiding this comment

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

it's fixed ! my tests pass in my local env

Copy link
Contributor

Choose a reason for hiding this comment

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

Lovely! Now I see everything's running perfectly :)

@avasconcelos114
Copy link
Contributor

@ogi-m this should be now ready to be tested following the steps Nevy posted earlier

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

Labels

3: QA Review Requires review by a QA tester Contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

For "Issue has been labeled" events, subscriptions do not respect the "render-style" flag for the post size

5 participants