diff --git a/README.md b/README.md index 2b4b584..775e96b 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ To install the plugin, put zip archive to 'plugins' dir under TeamCity data dire * custom actions for threads (create issue in bug tracker if broken build, open drop folder, open web app etc.) * view test results in notification * custom user image (instead or if no Gravatar) +* more options to customize behaviour Big thanks to [tcSlackBuildNotifier](https://github.com/PeteGoo/tcSlackBuildNotifier) which was quite useful for finding out how TeamCity and a custom notifier work :) diff --git a/flowdock-teamcity-plugin-server/src/main/kotlin/com/adrianfaciu/teamcity/flowdockPlugin/core/NotificationBuilder.kt b/flowdock-teamcity-plugin-server/src/main/kotlin/com/adrianfaciu/teamcity/flowdockPlugin/core/NotificationBuilder.kt index ba37763..67d088c 100644 --- a/flowdock-teamcity-plugin-server/src/main/kotlin/com/adrianfaciu/teamcity/flowdockPlugin/core/NotificationBuilder.kt +++ b/flowdock-teamcity-plugin-server/src/main/kotlin/com/adrianfaciu/teamcity/flowdockPlugin/core/NotificationBuilder.kt @@ -44,7 +44,7 @@ class NotificationBuilder(val flowdockConfig: FlowdockSettingsRepo, val tcServer notification.author = NotificationAuthor(user.name, this.getUserGravatar(user.email), user.email) notification.title = " TeamCity - ${project?.name}" - notification.body = this.getDefaultNotificationMessage(notificationDetails) + notification.body = this.getDefaultNotificationMessage(type, notificationDetails, build) notification.external_thread_id= "TC-${project?.projectId}" if (build != null) { notification.external_thread_id += "- ${build.fullName}" @@ -96,8 +96,19 @@ class NotificationBuilder(val flowdockConfig: FlowdockSettingsRepo, val tcServer * Creating notification body (html allowed) * Should let user create a custom message... */ - private fun getDefaultNotificationMessage(details: NotificationDetails?): String { - return "${details?.text}" + private fun getDefaultNotificationMessage(type: NotificationType, details: NotificationDetails?, build: SRunningBuild?): String { + var message = "${details?.text}" + + if (build != null) { + message += " - Build No: " + build.buildNumber + + if (type == NotificationType.BuildFailed) { + message += "
" + message += build.compilationErrorMessages.first() + } + } + + return message } /**