File tree 8 files changed +18
-29
lines changed
8 files changed +18
-29
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,6 @@ import (
11
11
"code.gitea.io/gitea/modules/setting"
12
12
)
13
13
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
-
22
14
// SanitizeFlashErrorString will sanitize a flash error string
23
15
func SanitizeFlashErrorString (x string ) string {
24
16
return strings .ReplaceAll (html .EscapeString (x ), "\n " , "<br>" )
Original file line number Diff line number Diff line change @@ -11,12 +11,6 @@ import (
11
11
"github.com/stretchr/testify/assert"
12
12
)
13
13
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
-
20
14
func TestIsExternalURL (t * testing.T ) {
21
15
setting .AppURL = "https://try.gitea.io/"
22
16
type test struct {
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ import (
24
24
"code.gitea.io/gitea/modules/log"
25
25
"code.gitea.io/gitea/modules/setting"
26
26
"code.gitea.io/gitea/modules/web"
27
- "code.gitea.io/gitea/routers/utils"
28
27
shared_user "code.gitea.io/gitea/routers/web/shared/user"
29
28
"code.gitea.io/gitea/services/convert"
30
29
"code.gitea.io/gitea/services/forms"
@@ -127,7 +126,7 @@ func TeamsAction(ctx *context.Context) {
127
126
ctx .Error (http .StatusNotFound )
128
127
return
129
128
}
130
- uname := utils . RemoveUsernameParameterSuffix ( strings .ToLower (ctx .FormString ("uname" ) ))
129
+ uname := strings .ToLower (ctx .FormString ("uname" ))
131
130
var u * user_model.User
132
131
u , err = user_model .GetUserByName (ctx , uname )
133
132
if err != nil {
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import (
17
17
"code.gitea.io/gitea/modules/log"
18
18
repo_module "code.gitea.io/gitea/modules/repository"
19
19
"code.gitea.io/gitea/modules/setting"
20
- "code.gitea.io/gitea/routers/utils"
21
20
"code.gitea.io/gitea/services/mailer"
22
21
org_service "code.gitea.io/gitea/services/org"
23
22
repo_service "code.gitea.io/gitea/services/repository"
@@ -52,7 +51,7 @@ func Collaboration(ctx *context.Context) {
52
51
53
52
// CollaborationPost response for actions for a collaboration of a repository
54
53
func CollaborationPost (ctx * context.Context ) {
55
- name := utils . RemoveUsernameParameterSuffix ( strings .ToLower (ctx .FormString ("collaborator" ) ))
54
+ name := strings .ToLower (ctx .FormString ("collaborator" ))
56
55
if len (name ) == 0 || ctx .Repo .Owner .LowerName == name {
57
56
ctx .Redirect (setting .AppSubURL + ctx .Req .URL .EscapedPath ())
58
57
return
@@ -144,7 +143,7 @@ func AddTeamPost(ctx *context.Context) {
144
143
return
145
144
}
146
145
147
- name := utils . RemoveUsernameParameterSuffix ( strings .ToLower (ctx .FormString ("team" ) ))
146
+ name := strings .ToLower (ctx .FormString ("team" ))
148
147
if len (name ) == 0 {
149
148
ctx .Redirect (ctx .Repo .RepoLink + "/settings/collaboration" )
150
149
return
Original file line number Diff line number Diff line change @@ -196,10 +196,14 @@ a.label,
196
196
.ui .search > .results {
197
197
background : var (--color-body );
198
198
border-color : var (--color-secondary );
199
+ overflow-wrap : anywhere; /* allow text to wrap as fomantic limits this to 18em width */
199
200
}
200
201
201
202
.ui .search > .results .result {
202
203
background : var (--color-body );
204
+ border-color : var (--color-secondary );
205
+ display : flex;
206
+ align-items : center;
203
207
}
204
208
205
209
.ui .search > .results .result .title {
Original file line number Diff line number Diff line change 2128
2128
}
2129
2129
2130
2130
# search-user-box .results .result .image {
2131
- float : left ;
2132
- margin-right : 8 px ;
2131
+ order : 0 ;
2132
+ margin-right : 12 px ;
2133
2133
width : 2em ;
2134
2134
height : 2em ;
2135
+ min-width : 2em ;
2136
+ min-height : 2em ;
2135
2137
}
2136
2138
2137
2139
# 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` */
2139
2141
}
2140
2142
2141
2143
.ui .menu .item > img : not (.ui ) {
Original file line number Diff line number Diff line change @@ -17,14 +17,13 @@ export function initCompSearchUserBox() {
17
17
const searchQuery = $searchUserBox . find ( 'input' ) . val ( ) ;
18
18
const searchQueryUppercase = searchQuery . toUpperCase ( ) ;
19
19
$ . 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
- }
24
20
const resultItem = {
25
- title,
21
+ title : item . login ,
26
22
image : item . avatar_url
27
23
} ;
24
+ if ( item . full_name ) {
25
+ resultItem . description = htmlEscape ( item . full_name ) ;
26
+ }
28
27
if ( searchQueryUppercase === item . login . toUpperCase ( ) ) {
29
28
items . unshift ( resultItem ) ;
30
29
} else {
Original file line number Diff line number Diff line change @@ -52,9 +52,9 @@ export function initRepoSettingSearchTeamBox() {
52
52
onResponse ( response ) {
53
53
const items = [ ] ;
54
54
$ . each ( response . data , ( _i , item ) => {
55
- const title = `${ item . name } (${ item . permission } access)` ;
56
55
items . push ( {
57
- title,
56
+ title : item . name ,
57
+ description : `${ item . permission } access` // TODO: translate this string
58
58
} ) ;
59
59
} ) ;
60
60
You can’t perform that action at this time.
0 commit comments