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

Fix Teams workflow webhook #4957

Open
wants to merge 5 commits into
base: 1.23.X
Choose a base branch
from

Conversation

Tabisch
Copy link

@Tabisch Tabisch commented Jul 23, 2024

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

This commit backports a slightly modified version the Adaptive-Templeate found in the Master-branch.
The version of the template used is from commit 2c31f3a.

All previously created connector webhook will keep working until Microsoft removes this functionality October 1st 2024.
https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/
All new webhooks set up via workflows will use the backported version.

Line 13 in Teams.vue might need to be modified later. Teams.vue
I was not able to find any Microsoft documentation that can replace that link that this point in time.

Fixes #4934
Fixes #4922

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
  • My changes generates no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

Connector webhook (legacy)
image
image
image

Workflow webhook
image
image
image

This commit backports the Adaptive-Templeate.
The version of the template uses is from commit 2c31f3a.
downgrade version, otherwise the error "We're sorry, this card couldn't be displayed" will be displayed when using flowbot, which is default
@CommanderStorm CommanderStorm added area:notifications Everything related to notifications type:enhance-existing feature wants to enhance existing monitor pr:needs review this PR needs a review by maintainers or other community members labels Jul 26, 2024
Copy link
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

There are lots of changes between your version and the version in master.
image

Yes, that version is also not perfect, but given how hard it is to review backported versions, please stick to master as close as possible.
There are tons of changes in this PR (compared to master). Most of those don't quite seem intentional or are at least not explained.

This is not a backport, this is a backport with changes in the same commit. Reviewing these changes is pretty hard, given that I now don't have a diff and creates future merge conflicts.

Because of how hard this is to review otherwise:

  • Please start with master,
  • and then (in different commits) change what is needed only.

That way, reviewing becomes possible again.

I have tried to go through your changes and have commented on the things which are most unclear.

});
}

// if (heartbeatJSON?.localDateTime) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why did you comment this out?

Copy link
Author

Choose a reason for hiding this comment

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

I modified the passed paramters to match the old function.
Currently there is no heartbeatJSON in that function.

const payload = {
"type": "message",
// message with status prefix as notification text
"summary": this._statusMessageFactory(status, monitorName, true),
Copy link
Collaborator

Choose a reason for hiding this comment

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

No thrid parameter exists in your modified version of _statusMessageFactory ^^

* @param {string} monitorUrl URL of monitor affected
* @returns {Object}
*/
_notificationPayloadFactoryLegacy = ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the legacy code (including where this function is used)
If microsoft decides to no longer support the webhooks, it is not worth adding code to support them.

Since the feature would be broken otherwise I think this is still a semver patch without this.

Currently, this just produces a bigger merge conflict ^^

Copy link
Author

Choose a reason for hiding this comment

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

Sure, I can do that.
My thinking was, that i want to keep the old Webhooks running until Mircosoft gets rid of them.
Thought that breaking the old webhooks before that would result in this being classified as a breaking change.

Normally I would have removed that code in a second PR after this one.
If this is a hard requirement to get this merged, i get rid of it now.

@CommanderStorm CommanderStorm added pr:please address review comments this PR needs a bit more work to be mergable and removed pr:needs review this PR needs a review by maintainers or other community members labels Jul 28, 2024
@CommanderStorm CommanderStorm linked an issue Aug 23, 2024 that may be closed by this pull request
2 tasks
@CommanderStorm CommanderStorm mentioned this pull request Aug 23, 2024
2 tasks
@tpai
Copy link

tpai commented Sep 3, 2024

Hi @Tabisch In case you don't have time to follow up, I created a PR for your branch based on @CommanderStorm 's requirement.

Tabisch#1

Please feel free to have a look.

@Tabisch
Copy link
Author

Tabisch commented Sep 4, 2024

@tpai
Looks good to me.
Merged it.

Totally forgot that this was still open.
Thank you for cleaning that up for me.

@CommanderStorm CommanderStorm added pr:needs review this PR needs a review by maintainers or other community members and removed pr:please address review comments this PR needs a bit more work to be mergable labels Sep 4, 2024
@viceice
Copy link

viceice commented Sep 12, 2024

@CommanderStorm Can you please review this PR again 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:notifications Everything related to notifications pr:needs review this PR needs a review by maintainers or other community members type:enhance-existing feature wants to enhance existing monitor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

teams_workflow
4 participants