From 58f4f91835fff9f7692d191784cdcec28d278af9 Mon Sep 17 00:00:00 2001 From: Tomas Bjerre Date: Wed, 1 Mar 2017 19:51:30 +0100 Subject: [PATCH] Only projects objects on project level #202 --- CHANGELOG.md | 9 +++++++-- src/main/java/se/bjurr/prnfb/service/PrnfbVariable.java | 2 +- src/main/resources/admin.js | 8 +++++++- src/main/resources/admin.vm | 9 +++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6501d5da..f30f7727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,15 @@ Changelog of Pull Request Notifier for Bitbucket. ## Unreleased +### GitHub [#202](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/202) Pull Request Notifier for Bitbucket: project-level admin page displays objects from more than one project. + Only projects objects on project level + + [120aa353cb3fc2c](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/120aa353cb3fc2c) Tomas Bjerre *2017-03-01 18:53:50* + ### GitHub [#204](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/204) Allow only specific users or group triggering a custom button? - PULL_REQUEST_USER_GRUPS variable + PULL_REQUEST_USER_GROUPS variable - [c0441391bfb1b35](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/c0441391bfb1b35) Tomas Bjerre *2017-03-01 18:47:23* + [ce0079ebc0e3ef3](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/ce0079ebc0e3ef3) Tomas Bjerre *2017-03-01 18:51:17* ### No issue Git Changelog Maven plugin 1.39 and using HTTP diff --git a/src/main/java/se/bjurr/prnfb/service/PrnfbVariable.java b/src/main/java/se/bjurr/prnfb/service/PrnfbVariable.java index 21b674ca..d9391a93 100644 --- a/src/main/java/se/bjurr/prnfb/service/PrnfbVariable.java +++ b/src/main/java/se/bjurr/prnfb/service/PrnfbVariable.java @@ -1084,7 +1084,7 @@ public String resolve( ClientKeyStore clientKeyStore, boolean shouldAcceptAnyCertificate, SecurityService securityService) { - return variables.get(PULL_REQUEST_USER_GROUPS).get(); + return getOrEmpty(variables,PULL_REQUEST_USER_GROUPS); } }), PULL_REQUEST_USER_DISPLAY_NAME( diff --git a/src/main/resources/admin.js b/src/main/resources/admin.js index 3599a537..767714bd 100644 --- a/src/main/resources/admin.js +++ b/src/main/resources/admin.js @@ -12,12 +12,18 @@ define('plugin/prnfb/admin', [ var buttonsAdminUrlPostUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings/buttons"; var buttonsAdminUrl = buttonsAdminUrlPostUrl; + var projectKey; if ($('#prnfbRepositorySlug').length !== 0) { - var projectKey = $('#prnfbProjectKey').val(); + projectKey = $('#prnfbProjectKey').val(); var repositorySlug = $('#prnfbRepositorySlug').val(); notificationsAdminUrl = notificationsAdminUrlPostUrl + '/projectKey/' + projectKey + '/repositorySlug/' + repositorySlug; buttonsAdminUrl = buttonsAdminUrlPostUrl + '/projectKey/' + projectKey + '/repositorySlug/' + repositorySlug; + } else if ($('#prnfbProjectKey').length !== 0) { + projectKey = $('#prnfbProjectKey').val(); + + notificationsAdminUrl = notificationsAdminUrlPostUrl + '/projectKey/' + projectKey; + buttonsAdminUrl = buttonsAdminUrlPostUrl + '/projectKey/' + projectKey; } $(document) diff --git a/src/main/resources/admin.vm b/src/main/resources/admin.vm index b9a05a1d..dab7b538 100644 --- a/src/main/resources/admin.vm +++ b/src/main/resources/admin.vm @@ -35,6 +35,14 @@ #end + + #if($project) + + + + #end + +
@@ -66,6 +74,7 @@
  • ${PULL_REQUEST_USER_ID} Example: 1
  • ${PULL_REQUEST_USER_NAME} Example: some.user
  • ${PULL_REQUEST_USER_SLUG} Example: some.user
  • +
  • ${PULL_REQUEST_USER_GROUPS} Example: ADMIN,DEV
  • ${PULL_REQUEST_AUTHOR_DISPLAY_NAME} Example: Administrator
  • ${PULL_REQUEST_AUTHOR_EMAIL} Example: admin@example.com
  • ${PULL_REQUEST_AUTHOR_ID} Example: 1