Skip to content

Commit 508fded

Browse files
committed
Merge branch 'main' into admin-user-list-filter
2 parents 1806f1a + 4389b2c commit 508fded

File tree

36 files changed

+1332
-428
lines changed

36 files changed

+1332
-428
lines changed

.stylelintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ rules:
1313
rule-empty-line-before: null
1414
selector-pseudo-element-colon-notation: double
1515
shorthand-property-no-redundant-values: true
16+
no-invalid-position-at-import-rule: null

custom/conf/app.example.ini

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,10 +1035,10 @@ PATH =
10351035
;SHOW_USER_EMAIL = true
10361036
;;
10371037
;; Set the default theme for the Gitea install
1038-
;DEFAULT_THEME = gitea
1038+
;DEFAULT_THEME = auto
10391039
;;
10401040
;; All available themes. Allow users select personalized themes regardless of the value of `DEFAULT_THEME`.
1041-
;THEMES = gitea,arc-green
1041+
;THEMES = auto,gitea,arc-green
10421042
;;
10431043
;; All available reactions users can choose on issues/prs and comments.
10441044
;; Values can be emoji alias (:smile:) or a unicode emoji.
@@ -2081,6 +2081,15 @@ PATH =
20812081
;; Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291 (false by default)
20822082
;ALLOW_LOCALNETWORKS = false
20832083

2084+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2085+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2086+
;[federation]
2087+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2088+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2089+
;;
2090+
;; Enable/Disable federation capabilities
2091+
; ENABLED = true
2092+
20842093
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20852094
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20862095
;; default storage for attachments, lfs and avatars

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
115115

116116
- `ALLOWED_TYPES`: **\<empty\>**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
117117
- `DEFAULT_PAGING_NUM`: **10**: The default paging number of releases user interface
118+
- For settings related to file attachments on releases, see the `attachment` section.
118119

119120
### Repository - Signing (`repository.signing`)
120121

@@ -173,9 +174,9 @@ The following configuration set `Content-Type: application/vnd.android.package-a
173174
- `FEED_PAGING_NUM`: **20**: Number of items that are displayed in home feed.
174175
- `GRAPH_MAX_COMMIT_NUM`: **100**: Number of maximum commits shown in the commit graph.
175176
- `CODE_COMMENT_LINES`: **4**: Number of line of codes shown for a code comment.
176-
- `DEFAULT_THEME`: **gitea**: \[gitea, arc-green\]: Set the default theme for the Gitea install.
177+
- `DEFAULT_THEME`: **auto**: \[auto, gitea, arc-green\]: Set the default theme for the Gitea install.
177178
- `SHOW_USER_EMAIL`: **true**: Whether the email of the user should be shown in the Explore Users page.
178-
- `THEMES`: **gitea,arc-green**: All available themes. Allow users select personalized themes.
179+
- `THEMES`: **auto,gitea,arc-green**: All available themes. Allow users select personalized themes.
179180
regardless of the value of `DEFAULT_THEME`.
180181
- `THEME_COLOR_META_TAG`: **#6cc644**: Value of `theme-color` meta tag, used by Android >= 5.0. An invalid color like "none" or "disable" will have the default style. More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
181182
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB)
@@ -952,6 +953,10 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
952953
- `ALLOW_LOCALNETWORKS`: **false**: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291
953954
- `SKIP_TLS_VERIFY`: **false**: Allow skip tls verify
954955

956+
## Federation (`federation`)
957+
958+
- `ENABLED`: **true**: Enable/Disable federation capabilities
959+
955960
## Mirror (`mirror`)
956961

957962
- `ENABLED`: **true**: Enables the mirror functionality. Set to **false** to disable all mirrors.

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ A full list of supported emoji's is at [emoji list](https://gitea.com/gitea/gite
321321

322322
## Customizing the look of Gitea
323323

324-
The default built-in themes are `gitea` (light) and `arc-green` (dark).
324+
The default built-in themes are `gitea` (light), `arc-green` (dark), and `auto` (chooses light or dark depending on operating system settings).
325325
The default theme can be changed via `DEFAULT_THEME` in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini`.
326326

327327
Gitea also has support for user themes, which means every user can select which theme should be used.

docs/content/doc/help/faq.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Use [Fail2Ban]({{< relref "doc/usage/fail2ban-setup.en-us.md" >}}) to monitor an
158158

159159
## How to add/use custom themes
160160

161-
Gitea supports two official themes right now, `gitea` and `arc-green` (`light` and `dark` respectively)
161+
Gitea supports three official themes right now, `gitea` (light), `arc-green` (dark), and `auto` (automatically switches between the previous two depending on operating system settings).
162162
To add your own theme, currently the only way is to provide a complete theme (not just color overrides)
163163

164164
As an example, let's say our theme is `arc-blue` (this is a real theme, and can be found [in this issue](https://github.com/go-gitea/gitea/issues/6011))

models/access.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ func (repo *Repository) refreshCollaboratorAccesses(e db.Engine, accessMap map[i
230230
return fmt.Errorf("getCollaborations: %v", err)
231231
}
232232
for _, c := range collaborators {
233+
if c.User.IsGhost() {
234+
continue
235+
}
233236
updateUserAccess(accessMap, c.User, c.Collaboration.Mode)
234237
}
235238
return nil

models/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func JSONUnmarshalHandleDoubleEncode(bs []byte, v interface{}) error {
5151
rs = append(rs, temp...)
5252
}
5353
if ok {
54-
if rs[0] == 0xff && rs[1] == 0xfe {
54+
if len(rs) > 1 && rs[0] == 0xff && rs[1] == 0xfe {
5555
rs = rs[2:]
5656
}
5757
err = json.Unmarshal(rs, v)

models/repo_collaboration.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"fmt"
1010

1111
"code.gitea.io/gitea/models/db"
12+
"code.gitea.io/gitea/modules/log"
1213
"code.gitea.io/gitea/modules/timeutil"
1314

1415
"xorm.io/builder"
@@ -88,16 +89,21 @@ func (repo *Repository) getCollaborators(e db.Engine, listOptions db.ListOptions
8889
return nil, fmt.Errorf("getCollaborations: %v", err)
8990
}
9091

91-
collaborators := make([]*Collaborator, len(collaborations))
92-
for i, c := range collaborations {
92+
collaborators := make([]*Collaborator, 0, len(collaborations))
93+
for _, c := range collaborations {
9394
user, err := getUserByID(e, c.UserID)
9495
if err != nil {
95-
return nil, err
96+
if IsErrUserNotExist(err) {
97+
log.Warn("Inconsistent DB: User: %d is listed as collaborator of %-v but does not exist", c.UserID, repo)
98+
user = NewGhostUser()
99+
} else {
100+
return nil, err
101+
}
96102
}
97-
collaborators[i] = &Collaborator{
103+
collaborators = append(collaborators, &Collaborator{
98104
User: user,
99105
Collaboration: c,
100-
}
106+
})
101107
}
102108
return collaborators, nil
103109
}

models/repo_transfer.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) (err e
274274
// Dummy object.
275275
collaboration := &Collaboration{RepoID: repo.ID}
276276
for _, c := range collaborators {
277+
if c.IsGhost() {
278+
collaboration.ID = c.Collaboration.ID
279+
if _, err := sess.Delete(collaboration); err != nil {
280+
return fmt.Errorf("remove collaborator '%d': %v", c.ID, err)
281+
}
282+
collaboration.ID = 0
283+
}
284+
277285
if c.ID != newOwner.ID {
278286
isMember, err := isOrganizationMember(sess, newOwner.ID, c.ID)
279287
if err != nil {
@@ -286,6 +294,7 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) (err e
286294
if _, err := sess.Delete(collaboration); err != nil {
287295
return fmt.Errorf("remove collaborator '%d': %v", c.ID, err)
288296
}
297+
collaboration.UserID = 0
289298
}
290299

291300
// Remove old team-repository relations.

models/repo_unit.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,9 @@ func getUnitsByRepoID(e db.Engine, repoID int64) (units []*RepoUnit, err error)
220220

221221
return units, nil
222222
}
223+
224+
// UpdateRepoUnit updates the provided repo unit
225+
func UpdateRepoUnit(unit *RepoUnit) error {
226+
_, err := db.GetEngine(db.DefaultContext).ID(unit.ID).Update(unit)
227+
return err
228+
}

0 commit comments

Comments
 (0)