Browse Source

feat(invite): redesign for pending invite list, added revoke button and link, copy invite also works now, #2353

Torkel Ödegaard 10 years ago
parent
commit
024c112944

+ 4 - 0
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)
 }
 

+ 1 - 0
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"`

+ 1 - 0
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,

+ 6 - 1
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() {

+ 1 - 1
public/app/features/org/partials/invite.html

@@ -55,7 +55,7 @@
 			<div style="text-align: left; margin-top: 6px;">
 				<a ng-click="addInvite()">+ Invite another</a>
 				<div class="form-inline" style="margin-top: 20px">
-					<editor-checkbox text="Skip sending emails" model="options.skipEmails" change="targetBlur()"></editor-checkbox>
+					<editor-checkbox text="Skip sending invite email" model="options.skipEmails" change="targetBlur()"></editor-checkbox>
 				</div>
 			</div>
 

+ 2 - 1
public/app/features/org/partials/orgUsers.html

@@ -44,7 +44,7 @@
 					{{invite.email}}
 					<span ng-show="invite.name" style="padding-left: 20px"> {{invite.name}}</span>
 					<span class="pull-right">
-						<button class="btn btn-inverse btn-mini " data-clipboard-text="{{invite.url}}" clipboard-button>
+						<button class="btn btn-inverse btn-mini " data-clipboard-text="{{invite.url}}" clipboard-button ng-click="copyInviteToClipboard($event)"
 							<i class="fa fa-clipboard"></i> Copy Invite
 						</button>
 						&nbsp;
@@ -54,6 +54,7 @@
 						</a>
 					</span>
 					<div ng-show="invite.expanded">
+						<a href="{{invite.url}}">{{invite.url}}</a><br>
 						<button class="btn btn-inverse btn-mini">
 							<i class="fa fa-envelope-o"></i> Resend invite
 						</button>

+ 1 - 1
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',
       })