diff --git a/templates/admin/emails/list.tmpl b/templates/admin/emails/list.tmpl index 67e9cb05e89..153877174bf 100644 --- a/templates/admin/emails/list.tmpl +++ b/templates/admin/emails/list.tmpl @@ -47,8 +47,8 @@ {{range .Emails}} {{.Name}} - {{.FullName}} - {{.Email}} + {{.FullName}} + {{.Email}} {{if .IsPrimary}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} {{if .CanChange}} diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl index a0b6fd9bb05..9aa1d933f6a 100644 --- a/templates/admin/packages/list.tmpl +++ b/templates/admin/packages/list.tmpl @@ -56,8 +56,8 @@ {{end}} {{.Package.Type.Name}} - {{.Package.Name}} - {{.Version.Version}} + {{.Package.Name}} + {{.Version.Version}} {{.Creator.Name}} {{if .Repository}} diff --git a/templates/admin/user/list.tmpl b/templates/admin/user/list.tmpl index 3742b4ae851..45fed87a400 100644 --- a/templates/admin/user/list.tmpl +++ b/templates/admin/user/list.tmpl @@ -85,7 +85,7 @@ {{.ID}} {{.Name}} - {{.Email}} + {{.Email}} {{if .IsActive}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} {{if .IsAdmin}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} {{if .IsRestricted}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} diff --git a/tests/integration/auth_ldap_test.go b/tests/integration/auth_ldap_test.go index d2160a3dbea..25395f57210 100644 --- a/tests/integration/auth_ldap_test.go +++ b/tests/integration/auth_ldap_test.go @@ -226,45 +226,20 @@ func TestLDAPUserSync(t *testing.T) { addAuthSourceLDAP(t, "", "") auth.SyncExternalUsers(context.Background(), true) - session := loginUser(t, "user1") // Check if users exists - for _, u := range gitLDAPUsers { - req := NewRequest(t, "GET", "/admin/users?q="+u.UserName) - resp := session.MakeRequest(t, req, http.StatusOK) - - htmlDoc := NewHTMLParser(t, resp.Body) - - tr := htmlDoc.doc.Find("table.table tbody tr") - if !assert.True(t, tr.Length() == 1) { - continue - } - tds := tr.Find("td") - if !assert.True(t, tds.Length() > 0) { - continue - } - assert.Equal(t, u.UserName, strings.TrimSpace(tds.Find("td:nth-child(2) a").Text())) - assert.Equal(t, u.Email, strings.TrimSpace(tds.Find("td:nth-child(3) span").Text())) - if u.IsAdmin { - assert.True(t, tds.Find("td:nth-child(5) svg").HasClass("octicon-check")) - } else { - assert.True(t, tds.Find("td:nth-child(5) svg").HasClass("octicon-x")) - } - if u.IsRestricted { - assert.True(t, tds.Find("td:nth-child(6) svg").HasClass("octicon-check")) - } else { - assert.True(t, tds.Find("td:nth-child(6) svg").HasClass("octicon-x")) - } + for _, gitLDAPUser := range gitLDAPUsers { + dbUser, err := user_model.GetUserByName(db.DefaultContext, gitLDAPUser.UserName) + assert.NoError(t, err) + assert.Equal(t, gitLDAPUser.UserName, dbUser.Name) + assert.Equal(t, gitLDAPUser.Email, dbUser.Email) + assert.Equal(t, gitLDAPUser.IsAdmin, dbUser.IsAdmin) + assert.Equal(t, gitLDAPUser.IsRestricted, dbUser.IsRestricted) } // Check if no users exist - for _, u := range otherLDAPUsers { - req := NewRequest(t, "GET", "/admin/users?q="+u.UserName) - resp := session.MakeRequest(t, req, http.StatusOK) - - htmlDoc := NewHTMLParser(t, resp.Body) - - tr := htmlDoc.doc.Find("table.table tbody tr") - assert.True(t, tr.Length() == 0) + for _, otherLDAPUser := range otherLDAPUsers { + _, err := user_model.GetUserByName(db.DefaultContext, otherLDAPUser.UserName) + assert.True(t, user_model.IsErrUserNotExist(err)) } } diff --git a/web_src/css/admin.css b/web_src/css/admin.css index 8c9d1e201c2..ec3cfbf22a3 100644 --- a/web_src/css/admin.css +++ b/web_src/css/admin.css @@ -26,10 +26,6 @@ margin: 12px -1rem -1rem; } -.admin.user table.table .email { - max-width: 200px; -} - .admin dl.admin-dl-horizontal { padding: 1em; margin: 0; diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css index 73f2ebe79bd..8a6c2c65390 100644 --- a/web_src/css/helpers.css +++ b/web_src/css/helpers.css @@ -52,6 +52,7 @@ Gitea's private styles use `g-` prefix. text-overflow: ellipsis; } +.gt-max-width-12rem { max-width: 12rem !important; } .gt-max-width-24rem { max-width: 24rem !important; } /* below class names match Tailwind CSS */