Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfca2c1

Browse files
committed
Merge branch 'main' of https://github.com/coder/coder into dk/system-notifications-o11y
2 parents 72bb1be + 7bb3e0d commit bfca2c1

File tree

18 files changed

+140
-34
lines changed

18 files changed

+140
-34
lines changed

coderd/apidoc/docs.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbmem/dbmem.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,8 @@ func (q *FakeQuerier) templateWithNameNoLock(tpl database.TemplateTable) databas
558558
withNames.CreatedByUsername = user.Username
559559
withNames.CreatedByAvatarURL = user.AvatarURL
560560
withNames.OrganizationName = org.Name
561+
withNames.OrganizationDisplayName = org.DisplayName
562+
withNames.OrganizationIcon = org.Icon
561563
return withNames
562564
}
563565

coderd/database/dump.sql

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
DROP VIEW template_with_names;
2+
3+
CREATE VIEW
4+
template_with_names
5+
AS
6+
SELECT
7+
templates.*,
8+
coalesce(visible_users.avatar_url, '') AS created_by_avatar_url,
9+
coalesce(visible_users.username, '') AS created_by_username,
10+
coalesce(organizations.name, '') AS organization_name
11+
FROM
12+
templates
13+
LEFT JOIN
14+
visible_users
15+
ON
16+
templates.created_by = visible_users.id
17+
LEFT JOIN
18+
organizations
19+
ON templates.organization_id = organizations.id
20+
;
21+
22+
COMMENT ON VIEW template_with_names IS 'Joins in the display name information such as username, avatar, and organization name.';
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-- Update the template_with_names view by recreating it.
2+
DROP VIEW template_with_names;
3+
CREATE VIEW
4+
template_with_names
5+
AS
6+
SELECT
7+
templates.*,
8+
coalesce(visible_users.avatar_url, '') AS created_by_avatar_url,
9+
coalesce(visible_users.username, '') AS created_by_username,
10+
coalesce(organizations.name, '') AS organization_name,
11+
coalesce(organizations.display_name, '') AS organization_display_name,
12+
coalesce(organizations.icon, '') AS organization_icon
13+
FROM
14+
templates
15+
LEFT JOIN
16+
visible_users
17+
ON
18+
templates.created_by = visible_users.id
19+
LEFT JOIN
20+
organizations
21+
ON templates.organization_id = organizations.id
22+
;
23+
24+
COMMENT ON VIEW template_with_names IS 'Joins in the display name information such as username, avatar, and organization name.';

coderd/database/modelqueries.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ func (q *sqlQuerier) GetAuthorizedTemplates(ctx context.Context, arg GetTemplate
117117
&i.CreatedByAvatarURL,
118118
&i.CreatedByUsername,
119119
&i.OrganizationName,
120+
&i.OrganizationDisplayName,
121+
&i.OrganizationIcon,
120122
); err != nil {
121123
return nil, err
122124
}

coderd/database/models.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/templates.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,8 @@ func (api *API) convertTemplate(
886886
UpdatedAt: template.UpdatedAt,
887887
OrganizationID: template.OrganizationID,
888888
OrganizationName: template.OrganizationName,
889+
OrganizationDisplayName: template.OrganizationDisplayName,
890+
OrganizationIcon: template.OrganizationIcon,
889891
Name: template.Name,
890892
DisplayName: template.DisplayName,
891893
Provisioner: codersdk.ProvisionerType(template.Provisioner),

0 commit comments

Comments
 (0)