diff --git a/.stylelintrc.yaml b/.stylelintrc.yaml index d51a08bf8e596..ca0f16b07b6c0 100644 --- a/.stylelintrc.yaml +++ b/.stylelintrc.yaml @@ -1,44 +1,133 @@ -extends: stylelint-config-standard - plugins: - stylelint-declaration-strict-value overrides: - files: ["**/*.less"] customSyntax: postcss-less - - files: ["**/*.less"] - rules: - scale-unlimited/declaration-strict-value: [color, { - ignoreValues: /^(inherit|transparent|unset|initial)$/ - }] - files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console/*"] rules: scale-unlimited/declaration-strict-value: null rules: alpha-value-notation: null + annotation-no-unknown: true + at-rule-allowed-list: null + at-rule-disallowed-list: null at-rule-empty-line-before: null - block-closing-brace-empty-line-before: null + at-rule-no-unknown: true + at-rule-no-vendor-prefix: true + at-rule-property-required-list: null + block-no-empty: true color-function-notation: null + color-hex-alpha: null color-hex-length: null + color-named: null + color-no-hex: null + color-no-invalid-hex: true comment-empty-line-before: null + comment-no-empty: true + comment-pattern: null + comment-whitespace-inside: null + comment-word-disallowed-list: null + custom-media-pattern: null + custom-property-empty-line-before: null + custom-property-no-missing-var-function: true + custom-property-pattern: null + declaration-block-no-duplicate-custom-properties: true + declaration-block-no-duplicate-properties: [true, {ignore: [consecutive-duplicates-with-different-values]}] declaration-block-no-redundant-longhand-properties: null + declaration-block-no-shorthand-property-overrides: null declaration-block-single-line-max-declarations: null declaration-empty-line-before: null + declaration-no-important: null + declaration-property-max-values: null + declaration-property-unit-allowed-list: null + declaration-property-unit-disallowed-list: null + declaration-property-value-allowed-list: null + declaration-property-value-disallowed-list: null + declaration-property-value-no-unknown: true + font-family-name-quotes: always-where-recommended + font-family-no-duplicate-names: true + font-family-no-missing-generic-family-keyword: true + font-weight-notation: null + function-allowed-list: null + function-calc-no-unspaced-operator: true + function-disallowed-list: null + function-linear-gradient-no-nonstandard-direction: true + function-name-case: lower function-no-unknown: null + function-url-no-scheme-relative: null + function-url-quotes: always + function-url-scheme-allowed-list: null + function-url-scheme-disallowed-list: null hue-degree-notation: null import-notation: string - indentation: 2 - max-line-length: null + keyframe-block-no-duplicate-selectors: true + keyframe-declaration-no-important: true + keyframe-selector-notation: null + keyframes-name-pattern: null + length-zero-no-unit: true + max-nesting-depth: null + media-feature-name-allowed-list: null + media-feature-name-disallowed-list: null + media-feature-name-no-unknown: true + media-feature-name-no-vendor-prefix: true + media-feature-name-unit-allowed-list: null + media-feature-name-value-allowed-list: null + media-feature-range-notation: null + named-grid-areas-no-invalid: true no-descending-specificity: null + no-duplicate-at-import-rules: true + no-duplicate-selectors: true + no-empty-source: true + no-invalid-double-slash-comments: true no-invalid-position-at-import-rule: null - number-leading-zero: never + no-irregular-whitespace: true + no-unknown-animations: null number-max-precision: null + property-allowed-list: null + property-disallowed-list: null + property-no-unknown: true property-no-vendor-prefix: null rule-empty-line-before: null + rule-selector-property-disallowed-list: null + scale-unlimited/declaration-strict-value: [color, {ignoreValues: /^(inherit|transparent|unset|initial|currentcolor)$/}] + selector-attribute-name-disallowed-list: null + selector-attribute-operator-allowed-list: null + selector-attribute-operator-disallowed-list: null + selector-attribute-quotes: always selector-class-pattern: null + selector-combinator-allowed-list: null + selector-combinator-disallowed-list: null + selector-disallowed-list: null selector-id-pattern: null + selector-max-attribute: null + selector-max-class: null + selector-max-combinators: null + selector-max-compound-selectors: null + selector-max-id: null + selector-max-pseudo-class: null + selector-max-specificity: null + selector-max-type: null + selector-max-universal: null + selector-nested-pattern: null + selector-no-qualifying-type: null + selector-no-vendor-prefix: true + selector-not-notation: null + selector-pseudo-class-allowed-list: null + selector-pseudo-class-disallowed-list: null + selector-pseudo-class-no-unknown: true + selector-pseudo-element-allowed-list: null selector-pseudo-element-colon-notation: double + selector-pseudo-element-disallowed-list: null + selector-pseudo-element-no-unknown: true + selector-type-case: lower + selector-type-no-unknown: [true, {ignore: [custom-elements]}] shorthand-property-no-redundant-values: true - string-quotes: null - value-no-vendor-prefix: null + string-no-newline: true + time-min-milliseconds: null + unit-allowed-list: null + unit-disallowed-list: null + unit-no-unknown: true + value-keyword-case: null + value-no-vendor-prefix: [true, {ignoreValues: [box, inline-box]}] diff --git a/CHANGELOG.md b/CHANGELOG.md index 99a67884af53d..507722f31b1d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ This changelog goes through all the changes that have been made in each release without substantial changes to our git log; to see the highlights of what has been added to each release, please refer to the [blog](https://blog.gitea.io). +## [1.18.5](https://github.com/go-gitea/gitea/releases/tag/v1.18.5) - 2023-02-21 + +* ENHANCEMENTS + * Hide 2FA status from other members in organization members list (#22999) (#23023) +* BUGFIXES + * Add force_merge to merge request and fix checking mergable (#23010) (#23032) + * Use `--message=%s` for git commit message (#23028) (#23029) + * Render access log template as text instead of HTML (#23013) (#23025) + * Fix the Manually Merged form (#23015) (#23017) + * Use beforeCommit instead of baseCommit (#22949) (#22996) + * Display attachments of review comment when comment content is blank (#23035) (#23046) + * Return empty url for submodule tree entries (#23043) (#23048) + ## [1.18.4](https://github.com/go-gitea/gitea/releases/tag/1.18.4) - 2023-02-20 * SECURITY diff --git a/Dockerfile b/Dockerfile index 89f000882c57a..fad8ae1790d52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,5 +64,7 @@ CMD ["/bin/s6-svscan", "/etc/s6"] COPY docker/root / COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini +COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh RUN chmod 755 /usr/bin/entrypoint /app/gitea/gitea /usr/local/bin/gitea /usr/local/bin/environment-to-ini RUN chmod 755 /etc/s6/gitea/* /etc/s6/openssh/* /etc/s6/.s6-svscan/* +RUN chmod 644 /etc/profile.d/gitea_bash_autocomplete.sh diff --git a/Dockerfile.rootless b/Dockerfile.rootless index e92ce857d3cd3..98051f7ddba74 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -54,7 +54,9 @@ RUN chown git:git /var/lib/gitea /etc/gitea COPY docker/rootless / COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini +COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh 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 +RUN chmod 644 /etc/profile.d/gitea_bash_autocomplete.sh #git:git USER 1000:1000 diff --git a/contrib/autocompletion/README b/contrib/autocompletion/README new file mode 100644 index 0000000000000..1defd219d8aa1 --- /dev/null +++ b/contrib/autocompletion/README @@ -0,0 +1,17 @@ +Bash and Zsh completion +======================= + +From within the gitea root run: + +```bash +source contrib/autocompletion/bash_autocomplete +``` + +or for zsh run: + +```bash +source contrib/autocompletion/zsh_autocomplete +``` + +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`. +If gitea has been installed as a different program pass in the `PROG` environment variable to set the correct program name. diff --git a/contrib/autocompletion/bash_autocomplete b/contrib/autocompletion/bash_autocomplete new file mode 100755 index 0000000000000..5cb62f26a71c1 --- /dev/null +++ b/contrib/autocompletion/bash_autocomplete @@ -0,0 +1,30 @@ +#! /bin/bash +# Heavily inspired by https://github.com/urfave/cli + +_cli_bash_autocomplete() { + if [[ "${COMP_WORDS[0]}" != "source" ]]; then + local cur opts base + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + if [[ "$cur" == "-"* ]]; then + opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion ) + else + opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion ) + fi + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi +} + +if [ -z "$PROG" ] && [ ! "$(command -v gitea &> /dev/null)" ] ; then + complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete gitea +elif [ -z "$PROG" ]; then + complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete ./gitea + complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete "$PWD/gitea" +else + complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete "$PROG" + unset PROG +fi + + + diff --git a/contrib/autocompletion/zsh_autocomplete b/contrib/autocompletion/zsh_autocomplete new file mode 100644 index 0000000000000..b3b40df503f67 --- /dev/null +++ b/contrib/autocompletion/zsh_autocomplete @@ -0,0 +1,30 @@ +#compdef ${PROG:=gitea} + + +# Heavily inspired by https://github.com/urfave/cli + +_cli_zsh_autocomplete() { + + local -a opts + local cur + cur=${words[-1]} + if [[ "$cur" == "-"* ]]; then + opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}") + else + opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}") + fi + + if [[ "${opts[1]}" != "" ]]; then + _describe 'values' opts + else + _files + fi + + return +} + +if [ -z $PROG ] ; then + compdef _cli_zsh_autocomplete gitea +else + compdef _cli_zsh_autocomplete $(basename $PROG) +fi diff --git a/docs/config.yaml b/docs/config.yaml index 0a6d5d13f23a9..26f096b1cf3c7 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -18,7 +18,7 @@ params: description: Git with a cup of tea author: The Gitea Authors website: https://docs.gitea.io - version: 1.18.1 + version: 1.18.5 minGoVersion: 1.19 goVersion: 1.20 minNodeVersion: 16 diff --git a/docs/content/doc/developers/guidelines-frontend.en-us.md b/docs/content/doc/developers/guidelines-frontend.en-us.md index 23be6c67737af..7f4d87d9011ed 100644 --- a/docs/content/doc/developers/guidelines-frontend.en-us.md +++ b/docs/content/doc/developers/guidelines-frontend.en-us.md @@ -39,12 +39,20 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h ### Gitea specific guidelines: 1. Every feature (Fomantic-UI/jQuery module) should be put in separate files/directories. -2. HTML ids and classes should use kebab-case. +2. HTML ids and classes should use kebab-case, it's preferred to contain 2-3 feature related keywords. 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. -4. jQuery events across different features could use their own namespaces if there are potential conflicts. -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. -6. The backend can pass complex data to the frontend by using `ctx.PageData["myModuleData"] = map[]{}` -7. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue3. +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. +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. +6. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue3. +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)`. +8. Use semantic elements, prefer ` +
+
{{.CsrfTokenHtml}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 075b859a0438e..2a79c51ddf946 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -77,7 +77,7 @@ {{.locale.Tr "repo.find_file.go_to_file"}} {{end}} {{if or .CanAddFile .CanUploadFile}} - -
- -
- -
{{end}} {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo}} diff --git a/web_src/js/components/PullRequestMergeForm.vue b/web_src/js/components/PullRequestMergeForm.vue index 2e10ce2531f06..fc610d219426d 100644 --- a/web_src/js/components/PullRequestMergeForm.vue +++ b/web_src/js/components/PullRequestMergeForm.vue @@ -18,6 +18,7 @@ + +
+ +
+