Skip to content

Commit cf06ad5

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: Changelog 1.18.5 (go-gitea#23045) (go-gitea#23049) Add Bash and Zsh completion scripts (go-gitea#22646) Return empty url for submodule tree entries (go-gitea#23043) Fix the show/hide methods for string selector (go-gitea#23042) display attachments of review comment when comment content is blank (go-gitea#23035) Upgrade to stylelint 15 (go-gitea#22944) Add force_merge to merge request and fix checking mergable (go-gitea#23010) Improve PR Review Box UI (go-gitea#22986) Remove dashes between organization member avatars on hover (go-gitea#23034) Fix the Manually Merged form (go-gitea#23015) Remove delete button for review comment (go-gitea#23036) Improve frontend guidelines (go-gitea#23007) Use `--message=%s` for git commit message (go-gitea#23028)
2 parents 5386697 + 4d2d3bd commit cf06ad5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+518
-242
lines changed

.stylelintrc.yaml

+102-13
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,133 @@
1-
extends: stylelint-config-standard
2-
31
plugins:
42
- stylelint-declaration-strict-value
53

64
overrides:
75
- files: ["**/*.less"]
86
customSyntax: postcss-less
9-
- files: ["**/*.less"]
10-
rules:
11-
scale-unlimited/declaration-strict-value: [color, {
12-
ignoreValues: /^(inherit|transparent|unset|initial)$/
13-
}]
147
- files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console/*"]
158
rules:
169
scale-unlimited/declaration-strict-value: null
1710

1811
rules:
1912
alpha-value-notation: null
13+
annotation-no-unknown: true
14+
at-rule-allowed-list: null
15+
at-rule-disallowed-list: null
2016
at-rule-empty-line-before: null
21-
block-closing-brace-empty-line-before: null
17+
at-rule-no-unknown: true
18+
at-rule-no-vendor-prefix: true
19+
at-rule-property-required-list: null
20+
block-no-empty: true
2221
color-function-notation: null
22+
color-hex-alpha: null
2323
color-hex-length: null
24+
color-named: null
25+
color-no-hex: null
26+
color-no-invalid-hex: true
2427
comment-empty-line-before: null
28+
comment-no-empty: true
29+
comment-pattern: null
30+
comment-whitespace-inside: null
31+
comment-word-disallowed-list: null
32+
custom-media-pattern: null
33+
custom-property-empty-line-before: null
34+
custom-property-no-missing-var-function: true
35+
custom-property-pattern: null
36+
declaration-block-no-duplicate-custom-properties: true
37+
declaration-block-no-duplicate-properties: [true, {ignore: [consecutive-duplicates-with-different-values]}]
2538
declaration-block-no-redundant-longhand-properties: null
39+
declaration-block-no-shorthand-property-overrides: null
2640
declaration-block-single-line-max-declarations: null
2741
declaration-empty-line-before: null
42+
declaration-no-important: null
43+
declaration-property-max-values: null
44+
declaration-property-unit-allowed-list: null
45+
declaration-property-unit-disallowed-list: null
46+
declaration-property-value-allowed-list: null
47+
declaration-property-value-disallowed-list: null
48+
declaration-property-value-no-unknown: true
49+
font-family-name-quotes: always-where-recommended
50+
font-family-no-duplicate-names: true
51+
font-family-no-missing-generic-family-keyword: true
52+
font-weight-notation: null
53+
function-allowed-list: null
54+
function-calc-no-unspaced-operator: true
55+
function-disallowed-list: null
56+
function-linear-gradient-no-nonstandard-direction: true
57+
function-name-case: lower
2858
function-no-unknown: null
59+
function-url-no-scheme-relative: null
60+
function-url-quotes: always
61+
function-url-scheme-allowed-list: null
62+
function-url-scheme-disallowed-list: null
2963
hue-degree-notation: null
3064
import-notation: string
31-
indentation: 2
32-
max-line-length: null
65+
keyframe-block-no-duplicate-selectors: true
66+
keyframe-declaration-no-important: true
67+
keyframe-selector-notation: null
68+
keyframes-name-pattern: null
69+
length-zero-no-unit: true
70+
max-nesting-depth: null
71+
media-feature-name-allowed-list: null
72+
media-feature-name-disallowed-list: null
73+
media-feature-name-no-unknown: true
74+
media-feature-name-no-vendor-prefix: true
75+
media-feature-name-unit-allowed-list: null
76+
media-feature-name-value-allowed-list: null
77+
media-feature-range-notation: null
78+
named-grid-areas-no-invalid: true
3379
no-descending-specificity: null
80+
no-duplicate-at-import-rules: true
81+
no-duplicate-selectors: true
82+
no-empty-source: true
83+
no-invalid-double-slash-comments: true
3484
no-invalid-position-at-import-rule: null
35-
number-leading-zero: never
85+
no-irregular-whitespace: true
86+
no-unknown-animations: null
3687
number-max-precision: null
88+
property-allowed-list: null
89+
property-disallowed-list: null
90+
property-no-unknown: true
3791
property-no-vendor-prefix: null
3892
rule-empty-line-before: null
93+
rule-selector-property-disallowed-list: null
94+
scale-unlimited/declaration-strict-value: [color, {ignoreValues: /^(inherit|transparent|unset|initial|currentcolor)$/}]
95+
selector-attribute-name-disallowed-list: null
96+
selector-attribute-operator-allowed-list: null
97+
selector-attribute-operator-disallowed-list: null
98+
selector-attribute-quotes: always
3999
selector-class-pattern: null
100+
selector-combinator-allowed-list: null
101+
selector-combinator-disallowed-list: null
102+
selector-disallowed-list: null
40103
selector-id-pattern: null
104+
selector-max-attribute: null
105+
selector-max-class: null
106+
selector-max-combinators: null
107+
selector-max-compound-selectors: null
108+
selector-max-id: null
109+
selector-max-pseudo-class: null
110+
selector-max-specificity: null
111+
selector-max-type: null
112+
selector-max-universal: null
113+
selector-nested-pattern: null
114+
selector-no-qualifying-type: null
115+
selector-no-vendor-prefix: true
116+
selector-not-notation: null
117+
selector-pseudo-class-allowed-list: null
118+
selector-pseudo-class-disallowed-list: null
119+
selector-pseudo-class-no-unknown: true
120+
selector-pseudo-element-allowed-list: null
41121
selector-pseudo-element-colon-notation: double
122+
selector-pseudo-element-disallowed-list: null
123+
selector-pseudo-element-no-unknown: true
124+
selector-type-case: lower
125+
selector-type-no-unknown: [true, {ignore: [custom-elements]}]
42126
shorthand-property-no-redundant-values: true
43-
string-quotes: null
44-
value-no-vendor-prefix: null
127+
string-no-newline: true
128+
time-min-milliseconds: null
129+
unit-allowed-list: null
130+
unit-disallowed-list: null
131+
unit-no-unknown: true
132+
value-keyword-case: null
133+
value-no-vendor-prefix: [true, {ignoreValues: [box, inline-box]}]

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.18.5](https://github.com/go-gitea/gitea/releases/tag/v1.18.5) - 2023-02-21
8+
9+
* ENHANCEMENTS
10+
* Hide 2FA status from other members in organization members list (#22999) (#23023)
11+
* BUGFIXES
12+
* Add force_merge to merge request and fix checking mergable (#23010) (#23032)
13+
* Use `--message=%s` for git commit message (#23028) (#23029)
14+
* Render access log template as text instead of HTML (#23013) (#23025)
15+
* Fix the Manually Merged form (#23015) (#23017)
16+
* Use beforeCommit instead of baseCommit (#22949) (#22996)
17+
* Display attachments of review comment when comment content is blank (#23035) (#23046)
18+
* Return empty url for submodule tree entries (#23043) (#23048)
19+
720
## [1.18.4](https://github.com/go-gitea/gitea/releases/tag/1.18.4) - 2023-02-20
821

922
* SECURITY

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,7 @@ CMD ["/bin/s6-svscan", "/etc/s6"]
6464
COPY docker/root /
6565
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
6666
COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
67+
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
6768
RUN chmod 755 /usr/bin/entrypoint /app/gitea/gitea /usr/local/bin/gitea /usr/local/bin/environment-to-ini
6869
RUN chmod 755 /etc/s6/gitea/* /etc/s6/openssh/* /etc/s6/.s6-svscan/*
70+
RUN chmod 644 /etc/profile.d/gitea_bash_autocomplete.sh

Dockerfile.rootless

+2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ RUN chown git:git /var/lib/gitea /etc/gitea
5454
COPY docker/rootless /
5555
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
5656
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
57+
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
5758
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-setup.sh /app/gitea/gitea /usr/local/bin/gitea /usr/local/bin/environment-to-ini
59+
RUN chmod 644 /etc/profile.d/gitea_bash_autocomplete.sh
5860

5961
#git:git
6062
USER 1000:1000

contrib/autocompletion/README

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Bash and Zsh completion
2+
=======================
3+
4+
From within the gitea root run:
5+
6+
```bash
7+
source contrib/autocompletion/bash_autocomplete
8+
```
9+
10+
or for zsh run:
11+
12+
```bash
13+
source contrib/autocompletion/zsh_autocomplete
14+
```
15+
16+
These scripts will check if gitea is on the path and if so add autocompletion for `gitea`. Or if not autocompletion will work for `./gitea`.
17+
If gitea has been installed as a different program pass in the `PROG` environment variable to set the correct program name.
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#! /bin/bash
2+
# Heavily inspired by https://github.com/urfave/cli
3+
4+
_cli_bash_autocomplete() {
5+
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
6+
local cur opts base
7+
COMPREPLY=()
8+
cur="${COMP_WORDS[COMP_CWORD]}"
9+
if [[ "$cur" == "-"* ]]; then
10+
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
11+
else
12+
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
13+
fi
14+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
15+
return 0
16+
fi
17+
}
18+
19+
if [ -z "$PROG" ] && [ ! "$(command -v gitea &> /dev/null)" ] ; then
20+
complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete gitea
21+
elif [ -z "$PROG" ]; then
22+
complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete ./gitea
23+
complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete "$PWD/gitea"
24+
else
25+
complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete "$PROG"
26+
unset PROG
27+
fi
28+
29+
30+
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#compdef ${PROG:=gitea}
2+
3+
4+
# Heavily inspired by https://github.com/urfave/cli
5+
6+
_cli_zsh_autocomplete() {
7+
8+
local -a opts
9+
local cur
10+
cur=${words[-1]}
11+
if [[ "$cur" == "-"* ]]; then
12+
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
13+
else
14+
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
15+
fi
16+
17+
if [[ "${opts[1]}" != "" ]]; then
18+
_describe 'values' opts
19+
else
20+
_files
21+
fi
22+
23+
return
24+
}
25+
26+
if [ -z $PROG ] ; then
27+
compdef _cli_zsh_autocomplete gitea
28+
else
29+
compdef _cli_zsh_autocomplete $(basename $PROG)
30+
fi

docs/config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.18.1
21+
version: 1.18.5
2222
minGoVersion: 1.19
2323
goVersion: 1.20
2424
minNodeVersion: 16

docs/content/doc/developers/guidelines-frontend.en-us.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,20 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h
3939
### Gitea specific guidelines:
4040

4141
1. Every feature (Fomantic-UI/jQuery module) should be put in separate files/directories.
42-
2. HTML ids and classes should use kebab-case.
42+
2. HTML ids and classes should use kebab-case, it's preferred to contain 2-3 feature related keywords.
4343
3. HTML ids and classes used in JavaScript should be unique for the whole project, and should contain 2-3 feature related keywords. We recommend to use the `js-` prefix for classes that are only used in JavaScript.
44-
4. jQuery events across different features could use their own namespaces if there are potential conflicts.
45-
5. CSS styling for classes provided by frameworks should not be overwritten. Always use new class-names with 2-3 feature related keywords to overwrite framework styles.
46-
6. The backend can pass complex data to the frontend by using `ctx.PageData["myModuleData"] = map[]{}`
47-
7. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue3.
44+
4. CSS styling for classes provided by frameworks should not be overwritten. Always use new class names with 2-3 feature related keywords to overwrite framework styles. Gitea's helper CSS classes in `helpers.less` could be helpful.
45+
5. The backend can pass complex data to the frontend by using `ctx.PageData["myModuleData"] = map[]{}`, but do not expose whole models to the frontend to avoid leaking sensitive data.
46+
6. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue3.
47+
7. Clarify variable types, prefer `elem.disabled = true` instead of `elem.setAttribute('disabled', 'anything')`, prefer `$el.prop('checked', var === 'yes')` instead of `$el.prop('checked', var)`.
48+
8. Use semantic elements, prefer `<button class="ui button">` instead of `<div class="ui button">`.
49+
9. Avoid unnecessary `!important` in CSS, add comments to explain why it's necessary if it can't be avoided.
50+
51+
### Accessibility / ARIA
52+
53+
In history, Gitea heavily uses Fomantic UI which is not an accessibility-friendly framework.
54+
Gitea uses some patches to make Fomantic UI more accessible (see the `aria.js` and `aria.md`),
55+
but there are still many problems which need a lot of work and time to fix.
4856

4957
### Framework Usage
5058

docs/content/doc/installation/from-binary.en-us.md

+10
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ export GITEA_WORK_DIR=/var/lib/gitea/
129129
cp gitea /usr/local/bin/gitea
130130
```
131131

132+
### Adding bash/zsh autocompletion (from 1.19)
133+
134+
A script to enable bash-completion can be found at [`contrib/autocompletion/bash_autocomplete`](https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/autocompletion/bash_autocomplete). This can be copied to `/usr/share/bash-completion/completions/gitea`
135+
or sourced within your `.bashrc`.
136+
137+
Similarly a script for zsh-completion can be found at [`contrib/autocompletion/zsh_autocomplete`](https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/autocompletion/zsh_autocomplete). This can be copied to `/usr/share/zsh/_gitea` or sourced within your
138+
`.zshrc`.
139+
140+
YMMV and these scripts may need further improvement.
141+
132142
## Running Gitea
133143

134144
After you complete the above steps, you can run Gitea two ways:

docs/content/doc/installation/from-source.en-us.md

+10
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,13 @@ LDFLAGS="-linkmode external -extldflags '-static' $LDFLAGS" TAGS="netgo osusergo
193193
```
194194

195195
This can be combined with `CC`, `GOOS`, and `GOARCH` as above.
196+
197+
### Adding bash/zsh autocompletion (from 1.19)
198+
199+
A script to enable bash-completion can be found at [`contrib/autocompletion/bash_autocomplete`](https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/autocompletion/bash_autocomplete). This should be altered as appropriate and can be `source` in your `.bashrc`
200+
or copied as `/usr/share/bash-completion/completions/gitea`.
201+
202+
Similary a script for zsh-completion can be found at [`contrib/autocompletion/zsh_autocomplete`](https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/autocompletion/zsh_autocomplete). This can be copied to `/usr/share/zsh/_gitea` or sourced within your
203+
`.zshrc`.
204+
205+
YMMV and these scripts may need further improvement.

main.go

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ arguments - which can alternatively be run by running the subcommand web.`
113113
setFlagsAndBeforeOnSubcommands(&app.Commands[i], defaultFlags, establishCustomPath)
114114
}
115115

116+
app.EnableBashCompletion = true
117+
116118
err := app.Run(os.Args)
117119
if err != nil {
118120
log.Fatal("Failed to run app with %s: %v", os.Args, err)

modules/git/commit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func CommitChangesWithArgs(repoPath string, args TrustedCmdArgs, opts CommitChan
131131
if opts.Author != nil {
132132
cmd.AddOptionFormat("--author='%s <%s>'", opts.Author.Name, opts.Author.Email)
133133
}
134-
cmd.AddOptionValues("-m", opts.Message)
134+
cmd.AddOptionFormat("--message=%s", opts.Message)
135135

136136
_, _, err := cmd.RunStdString(&RunOpts{Dir: repoPath})
137137
// No stderr but exit status 1 means nothing to commit.

modules/repository/init.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,8 @@ func initRepoCommit(ctx context.Context, tmpPath string, repo *repo_model.Reposi
316316
return fmt.Errorf("git add --all: %w", err)
317317
}
318318

319-
cmd := git.NewCommand(ctx, "commit").
320-
AddOptionFormat("--author='%s <%s>'", sig.Name, sig.Email).
321-
AddOptionValues("-m", "Initial commit")
319+
cmd := git.NewCommand(ctx, "commit", "--message=Initial commit").
320+
AddOptionFormat("--author='%s <%s>'", sig.Name, sig.Email)
322321

323322
sign, keyID, signer, _ := asymkey_service.SignInitialCommit(ctx, tmpPath, u)
324323
if sign {

0 commit comments

Comments
 (0)