From 024c1129446015900625147ebdf5cd9e59e285d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 20 Jul 2015 14:26:49 +0200 Subject: [PATCH] feat(invite): redesign for pending invite list, added revoke button and link, copy invite also works now, #2353 --- pkg/api/org_invite.go | 4 ++++ pkg/models/temp_user.go | 1 + pkg/services/sqlstore/temp_user.go | 1 + public/app/features/org/orgUsersCtrl.js | 7 ++++++- public/app/features/org/partials/invite.html | 2 +- public/app/features/org/partials/orgUsers.html | 3 ++- public/app/routes/all.js | 2 +- 7 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pkg/api/org_invite.go b/pkg/api/org_invite.go index 0e9cc9a8da2..dd3431aa2d3 100644 --- a/pkg/api/org_invite.go +++ b/pkg/api/org_invite.go @@ -16,6 +16,10 @@ func GetPendingOrgInvites(c *middleware.Context) Response { return ApiError(500, "Failed to get invites from db", err) } + for _, invite := range query.Result { + invite.Url = setting.ToAbsUrl("invite/" + invite.Code) + } + return Json(200, query.Result) } diff --git a/pkg/models/temp_user.go b/pkg/models/temp_user.go index 13915c04bb8..f2c6173dd4c 100644 --- a/pkg/models/temp_user.go +++ b/pkg/models/temp_user.go @@ -75,6 +75,7 @@ type TempUserDTO struct { Role string `json:"role"` InvitedBy string `json:"invitedBy"` Code string `json:"code"` + Url string `json:"url"` EmailSent bool `json:"emailSent"` EmailSentOn time.Time `json:"emailSentOn"` Created time.Time `json:"createdOn"` diff --git a/pkg/services/sqlstore/temp_user.go b/pkg/services/sqlstore/temp_user.go index 9e8ce5be4b2..e8928f2c356 100644 --- a/pkg/services/sqlstore/temp_user.go +++ b/pkg/services/sqlstore/temp_user.go @@ -54,6 +54,7 @@ func GetTempUsersForOrg(query *m.GetTempUsersForOrgQuery) error { tu.email as email, tu.name as name, tu.role as role, + tu.code as code, tu.email_sent as email_sent, tu.email_sent_on as email_sent_on, tu.created as created, diff --git a/public/app/features/org/orgUsersCtrl.js b/public/app/features/org/orgUsersCtrl.js index e8543c98017..9ea34127906 100644 --- a/public/app/features/org/orgUsersCtrl.js +++ b/public/app/features/org/orgUsersCtrl.js @@ -38,10 +38,15 @@ function (angular) { backendSrv.delete('/api/org/users/' + user.userId).then($scope.get); }; - $scope.revokeInvite = function(invite) { + $scope.revokeInvite = function(invite, evt) { + evt.stopPropagation(); backendSrv.patch('/api/org/invites/' + invite.id + '/revoke').then($scope.get); }; + $scope.copyInviteToClipboard = function(evt) { + evt.stopPropagation(); + }; + $scope.openInviteModal = function() { var modalScope = $scope.$new(); modalScope.invitesSent = function() { diff --git a/public/app/features/org/partials/invite.html b/public/app/features/org/partials/invite.html index 6a18c816c68..d8ac5a434b7 100644 --- a/public/app/features/org/partials/invite.html +++ b/public/app/features/org/partials/invite.html @@ -55,7 +55,7 @@
+ Invite another
- +
diff --git a/public/app/features/org/partials/orgUsers.html b/public/app/features/org/partials/orgUsers.html index be011b31232..97d3573685e 100644 --- a/public/app/features/org/partials/orgUsers.html +++ b/public/app/features/org/partials/orgUsers.html @@ -44,7 +44,7 @@ {{invite.email}} {{invite.name}} -   @@ -54,6 +54,7 @@
+ {{invite.url}}
diff --git a/public/app/routes/all.js b/public/app/routes/all.js index a8018188a3d..0adca374452 100644 --- a/public/app/routes/all.js +++ b/public/app/routes/all.js @@ -97,7 +97,7 @@ define([ templateUrl: 'app/partials/login.html', controller : 'LoginCtrl', }) - .when('/signup/invited', { + .when('/invite/:code', { templateUrl: 'app/partials/signup_invited.html', controller : 'InvitedCtrl', })