File tree Expand file tree Collapse file tree 8 files changed +18
-29
lines changed
Expand file tree Collapse file tree 8 files changed +18
-29
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,6 @@ import (
1111 "code.gitea.io/gitea/modules/setting"
1212)
1313
14- // RemoveUsernameParameterSuffix returns the username parameter without the (fullname) suffix - leaving just the username
15- func RemoveUsernameParameterSuffix (name string ) string {
16- if index := strings .Index (name , " (" ); index >= 0 {
17- name = name [:index ]
18- }
19- return name
20- }
21-
2214// SanitizeFlashErrorString will sanitize a flash error string
2315func SanitizeFlashErrorString (x string ) string {
2416 return strings .ReplaceAll (html .EscapeString (x ), "\n " , "<br>" )
Original file line number Diff line number Diff line change @@ -11,12 +11,6 @@ import (
1111 "github.com/stretchr/testify/assert"
1212)
1313
14- func TestRemoveUsernameParameterSuffix (t * testing.T ) {
15- assert .Equal (t , "foobar" , RemoveUsernameParameterSuffix ("foobar (Foo Bar)" ))
16- assert .Equal (t , "foobar" , RemoveUsernameParameterSuffix ("foobar" ))
17- assert .Equal (t , "" , RemoveUsernameParameterSuffix ("" ))
18- }
19-
2014func TestIsExternalURL (t * testing.T ) {
2115 setting .AppURL = "https://try.gitea.io/"
2216 type test struct {
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ import (
2424 "code.gitea.io/gitea/modules/log"
2525 "code.gitea.io/gitea/modules/setting"
2626 "code.gitea.io/gitea/modules/web"
27- "code.gitea.io/gitea/routers/utils"
2827 shared_user "code.gitea.io/gitea/routers/web/shared/user"
2928 "code.gitea.io/gitea/services/convert"
3029 "code.gitea.io/gitea/services/forms"
@@ -127,7 +126,7 @@ func TeamsAction(ctx *context.Context) {
127126 ctx .Error (http .StatusNotFound )
128127 return
129128 }
130- uname := utils . RemoveUsernameParameterSuffix ( strings .ToLower (ctx .FormString ("uname" ) ))
129+ uname := strings .ToLower (ctx .FormString ("uname" ))
131130 var u * user_model.User
132131 u , err = user_model .GetUserByName (ctx , uname )
133132 if err != nil {
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import (
1717 "code.gitea.io/gitea/modules/log"
1818 repo_module "code.gitea.io/gitea/modules/repository"
1919 "code.gitea.io/gitea/modules/setting"
20- "code.gitea.io/gitea/routers/utils"
2120 "code.gitea.io/gitea/services/mailer"
2221 org_service "code.gitea.io/gitea/services/org"
2322 repo_service "code.gitea.io/gitea/services/repository"
@@ -52,7 +51,7 @@ func Collaboration(ctx *context.Context) {
5251
5352// CollaborationPost response for actions for a collaboration of a repository
5453func CollaborationPost (ctx * context.Context ) {
55- name := utils . RemoveUsernameParameterSuffix ( strings .ToLower (ctx .FormString ("collaborator" ) ))
54+ name := strings .ToLower (ctx .FormString ("collaborator" ))
5655 if len (name ) == 0 || ctx .Repo .Owner .LowerName == name {
5756 ctx .Redirect (setting .AppSubURL + ctx .Req .URL .EscapedPath ())
5857 return
@@ -144,7 +143,7 @@ func AddTeamPost(ctx *context.Context) {
144143 return
145144 }
146145
147- name := utils . RemoveUsernameParameterSuffix ( strings .ToLower (ctx .FormString ("team" ) ))
146+ name := strings .ToLower (ctx .FormString ("team" ))
148147 if len (name ) == 0 {
149148 ctx .Redirect (ctx .Repo .RepoLink + "/settings/collaboration" )
150149 return
Original file line number Diff line number Diff line change @@ -196,10 +196,14 @@ a.label,
196196.ui .search > .results {
197197 background : var (--color-body );
198198 border-color : var (--color-secondary );
199+ overflow-wrap : anywhere; /* allow text to wrap as fomantic limits this to 18em width */
199200}
200201
201202.ui .search > .results .result {
202203 background : var (--color-body );
204+ border-color : var (--color-secondary );
205+ display : flex;
206+ align-items : center;
203207}
204208
205209.ui .search > .results .result .title {
Original file line number Diff line number Diff line change 21282128}
21292129
21302130# search-user-box .results .result .image {
2131- float : left ;
2132- margin-right : 8 px ;
2131+ order : 0 ;
2132+ margin-right : 12 px ;
21332133 width : 2em ;
21342134 height : 2em ;
2135+ min-width : 2em ;
2136+ min-height : 2em ;
21352137}
21362138
21372139# search-user-box .results .result .content {
2138- margin : 6 px 0 ; /* this trick is used to align with the sibling avatar image */
2140+ margin : 0 ; /* remove margin reserved for avatar because we move it to left via `order: 0` */
21392141}
21402142
21412143.ui .menu .item > img : not (.ui ) {
Original file line number Diff line number Diff line change @@ -17,14 +17,13 @@ export function initCompSearchUserBox() {
1717 const searchQuery = $searchUserBox . find ( 'input' ) . val ( ) ;
1818 const searchQueryUppercase = searchQuery . toUpperCase ( ) ;
1919 $ . each ( response . data , ( _i , item ) => {
20- let title = item . login ;
21- if ( item . full_name && item . full_name . length > 0 ) {
22- title += ` (${ htmlEscape ( item . full_name ) } )` ;
23- }
2420 const resultItem = {
25- title,
21+ title : item . login ,
2622 image : item . avatar_url
2723 } ;
24+ if ( item . full_name ) {
25+ resultItem . description = htmlEscape ( item . full_name ) ;
26+ }
2827 if ( searchQueryUppercase === item . login . toUpperCase ( ) ) {
2928 items . unshift ( resultItem ) ;
3029 } else {
Original file line number Diff line number Diff line change @@ -52,9 +52,9 @@ export function initRepoSettingSearchTeamBox() {
5252 onResponse ( response ) {
5353 const items = [ ] ;
5454 $ . each ( response . data , ( _i , item ) => {
55- const title = `${ item . name } (${ item . permission } access)` ;
5655 items . push ( {
57- title,
56+ title : item . name ,
57+ description : `${ item . permission } access` // TODO: translate this string
5858 } ) ;
5959 } ) ;
6060
You can’t perform that action at this time.
0 commit comments