瀏覽代碼

add team name to slack integration

Alexander Belanger 4 年之前
父節點
當前提交
c337377e3f
共有 3 個文件被更改,包括 23 次插入7 次删除
  1. 6 2
      docker-compose.dev-secure.yaml
  2. 1 0
      internal/integrations/slack/slack.go
  3. 16 5
      internal/models/integrations/slack.go

+ 6 - 2
docker-compose.dev-secure.yaml

@@ -59,8 +59,12 @@ services:
     ports:
     ports:
       - 443:443
       - 443:443
     volumes:
     volumes:
-      - ./docker/localhost.crt:/etc/ssl/localhost.crt
-      - ./docker/localhost.key:/etc/ssl/localhost.key
+      - type: bind
+        source: ./docker/localhost.crt
+        target: /etc/ssl/localhost.crt
+      - type: bind
+        source: ./docker/localhost.key
+        target: /etc/ssl/localhost.key
       - ./docker/nginx_local_secure.conf:/etc/nginx/nginx.conf:ro
       - ./docker/nginx_local_secure.conf:/etc/nginx/nginx.conf:ro
     depends_on:
     depends_on:
       - porter
       - porter

+ 1 - 0
internal/integrations/slack/slack.go

@@ -28,6 +28,7 @@ func TokenToSlackIntegration(token *oauth2.Token) (*integrations.SlackIntegratio
 			AccessToken: []byte(token.AccessToken),
 			AccessToken: []byte(token.AccessToken),
 		},
 		},
 		TeamID:           teamInfo.Team.ID,
 		TeamID:           teamInfo.Team.ID,
+		TeamName:         teamInfo.Team.Name,
 		TeamIconURL:      teamInfo.Team.Icon.Image132,
 		TeamIconURL:      teamInfo.Team.Icon.Image132,
 		Channel:          webhookConfig["channel"].(string),
 		Channel:          webhookConfig["channel"].(string),
 		ChannelID:        webhookConfig["channel_id"].(string),
 		ChannelID:        webhookConfig["channel_id"].(string),

+ 16 - 5
internal/models/integrations/slack.go

@@ -19,6 +19,9 @@ type SlackIntegration struct {
 	// The ID for the Slack team
 	// The ID for the Slack team
 	TeamID string
 	TeamID string
 
 
+	// The name of the Slack team
+	TeamName string
+
 	// The icon url for the Slack team
 	// The icon url for the Slack team
 	TeamIconURL string
 	TeamIconURL string
 
 
@@ -49,21 +52,29 @@ type SlackIntegrationExternal struct {
 	// The ID for the Slack team
 	// The ID for the Slack team
 	TeamID string `json:"team_id"`
 	TeamID string `json:"team_id"`
 
 
+	// The name of the Slack team
+	TeamName string `json:"team_name"`
+
 	// The icon url for the Slack team
 	// The icon url for the Slack team
 	TeamIconURL string `json:"team_icon_url"`
 	TeamIconURL string `json:"team_icon_url"`
 
 
 	// The channel name that the Slack app is installed in
 	// The channel name that the Slack app is installed in
 	Channel string `json:"channel"`
 	Channel string `json:"channel"`
+
+	// The URL for configuring the workspace app instance
+	ConfigurationURL string `json:"configuration_url"`
 }
 }
 
 
 // Externalize generates an external SlackIntegration to be shared over
 // Externalize generates an external SlackIntegration to be shared over
 // rest
 // rest
 func (s *SlackIntegration) Externalize() *SlackIntegrationExternal {
 func (s *SlackIntegration) Externalize() *SlackIntegrationExternal {
 	return &SlackIntegrationExternal{
 	return &SlackIntegrationExternal{
-		ID:          s.ID,
-		ProjectID:   s.ProjectID,
-		TeamID:      s.TeamID,
-		TeamIconURL: s.TeamIconURL,
-		Channel:     s.Channel,
+		ID:               s.ID,
+		ProjectID:        s.ProjectID,
+		TeamID:           s.TeamID,
+		TeamName:         s.TeamName,
+		TeamIconURL:      s.TeamIconURL,
+		Channel:          s.Channel,
+		ConfigurationURL: s.ConfigurationURL,
 	}
 	}
 }
 }