summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Use CleanPath instead of path.Clean (#23371)Lunny Xiao2023-03-0813-28/+45
| | | As title.
* Reduce duplicate and useless code in options (#23369)Jason Song2023-03-086-158/+74
| | | | | | | | Avoid maintaining two copies of code, some functions can be used with both `bindata` and `no bindata`. And removed `GetRepoInitFile`, it's useless now. `Readme`/`Gitignore`/`License`/`Labels` will clean the name and use custom files when available.
* Clean Path in Options (#23006)JakobDev2023-03-082-8/+8
| | | | | | | | | | | | | | | At the Moment it is possible to read files in another Directory as supposed using the Options functions. e.g. `options.Gitignore("../label/Default) `. This was discovered while working on #22783, which exposes `options.Gitignore()` through the public API. At the moment, this is not a security problem, as this function is only used internal, but I thought it would be a good idea to make a PR to fix this for all types of Options files, not only Gitignore, to make it safe for the further. This PR should be merged before the linked PR. --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Do not recognize text files as audio (#23355)wxiaoguang2023-03-072-0/+14
| | | | | | | | | | | | Close #17108 This PR uses a trick (removing the ID3 tag) to detect the content again to to see whether the content is text type. --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix incorrect display for comment context menu (#23343)wxiaoguang2023-03-082-7/+8
| | | | | | | | | | | Replace #23342 Fix a regression of #23014: the `a` couldn't be used here because Fomantic UI has style conflicts: `.ui.comments .comment .actions a { display: inline-block; }` And complete one more of my TODOs: "in the future there could be a special CSS class for it"
* [skip ci] Updated translations via CrowdinGiteaBot2023-03-081-0/+1
|
* Pass context to avatar for projects view (#23359)delvh2023-03-071-1/+1
| | | | | | | | Previously, a 500 response was returned when - an issue had assignees - the issue was assigned to a project - you tried to view this project Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Refactor and tidy-up the merge/update branch code (#22568)zeripath2023-03-0712-607/+757
| | | | | | | | | | | | | | | | | | | The merge and update branch code was previously a little tangled and had some very long functions. The functions were not very clear in their reasoning and there were deficiencies in their logging and at least one bug in the handling of LFS for update by rebase. This PR substantially refactors this code and splits things out to into separate functions. It also attempts to tidy up the calls by wrapping things in "context"s. There are also attempts to improve logging when there are errors. Signed-off-by: Andrew Thornton <art27@cantab.net> --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: delvh <dev.lh@web.de>
* Fix adding of empty class name (#23352)Hester Gong2023-03-071-1/+2
| | | | | | | | | | | | | This PR is to fix the error shown below. The reason is because [`class-name` prop](https://github.com/go-gitea/gitea/blob/main/web_src/js/components/ActionRunStatus.vue#L6) given to `svg` component has a space, and classList cannot add empty string. https://user-images.githubusercontent.com/17645053/223346720-c7f9de43-5e69-4ecf-93c0-90bf04090693.mov --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix various ImageDiff/SVG bugs (#23312)wxiaoguang2023-03-074-17/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace #23310, Close #19733 And fix various UI problems, including regressions from #22959 #22950 and more. ## SVG Detection The old regexp may mismatch non-SVG files. This PR adds new tests for those cases. ## UI Changes ### Before ![image](https://user-images.githubusercontent.com/2114189/222967716-f6ad8721-f46a-4a3f-9eb0-a89e488d3436.png) ![image](https://user-images.githubusercontent.com/2114189/222967780-8af8981a-e69d-4304-9dc4-0235582fa4f4.png) ### After ![image](https://user-images.githubusercontent.com/2114189/222967575-c21c23d4-0200-4e09-aac3-57895e853000.png) ![image](https://user-images.githubusercontent.com/2114189/222967585-8b8da262-bc96-441a-9851-8d3845f2659d.png) ![image](https://user-images.githubusercontent.com/2114189/222967595-58d9bea5-6df4-41fa-bf8a-86704117959d.png) ![image](https://user-images.githubusercontent.com/2114189/222967608-38757c1a-b8bd-4ebf-b7a8-3b30edb7f303.png) ![image](https://user-images.githubusercontent.com/2114189/222967623-9849a339-6fae-4484-8fa5-939e2fdacbf5.png) ![image](https://user-images.githubusercontent.com/2114189/222967633-4383d7dd-62ba-47a3-8c10-86f7ca7757ae.png) --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Refactor `setting.Database.UseXXX` to methods (#23354)Jason Song2023-03-0736-96/+103
| | | | | | | | | | | Replace #23350. Refactor `setting.Database.UseMySQL` to `setting.Database.Type.IsMySQL()`. To avoid mismatching between `Type` and `UseXXX`. This refactor can fix the bug mentioned in #23350, so it should be backported.
* Update documentation for the new YAML label file format (#23020)JonRB2023-03-071-1/+14
| | | | | | | | | | | | update documentation to include an overview of the yaml label template that is part of PR #22976 Signed-off-by: Jon Roadley-Battin <jon.roadleybattin@gmail.com> --------- Co-authored-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* Remove unnecessary space on link (#23334)Lunny Xiao2023-03-061-1/+1
| | | The action run title has a blank. This PR removes it.
* Fix incorrect redirect link of delete org project (#23327)yp053272023-03-061-1/+1
| | | | | A part of https://github.com/go-gitea/gitea/pull/22865/commits The old code will cause 500 error.
* Fix incorrect project links and use symlink icon for org-wide projects (#23325)yp053272023-03-067-14/+14
| | | | | | | | | | | | Fix displaying same projects icons between user/repo projects. And fix incorrect projects links. A part of https://github.com/go-gitea/gitea/pull/22865. ![image](https://user-images.githubusercontent.com/18380374/223044279-7b620ff1-d88a-4146-97e6-531bbf269761.png) ![image](https://user-images.githubusercontent.com/18380374/223044390-42911e3f-1f6b-439f-8441-4f3ebf99ea13.png) ![image](https://user-images.githubusercontent.com/18380374/223044437-5cad5391-0f95-4c8b-b0a3-32e263e2854f.png)
* Fix PR view misalignment caused by long name file (#23321)Hester Gong2023-03-062-4/+19
| | | | | | | | | Close #23248 The UI after this PR: https://user-images.githubusercontent.com/17645053/223009758-7f0c9f12-d346-4cb2-a605-729fddce732f.mov
* Add ActionRunStatus component (#23259)yp053272023-03-062-16/+35
| | | | | | | | | | Related to: https://github.com/go-gitea/gitea/pull/23212#discussion_r1122856231 Decrease duplication of SvgIcon when display a run status svg. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Scoped labels: don't require holding alt key to remove (#23303)Brecht Van Lommel2023-03-061-6/+1
| | | | | | | | | Alt doesn't work on all browsers, the simplest solution for v1.19 is to just not require it and toggle the label by just clicking. Part of #22974 Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Update hacking-on-gitea-zh_cn documentation (#23315)Lunny Xiao2023-03-061-14/+320
| | | | | | | This PR fix outdated hacking-on-gitea-zh_cn documentation. --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Fix broken code editor diff preview (#23307)wxiaoguang2023-03-063-32/+35
| | | | | | | | | | | | | | | | | | | | | Close #23265, the code editor diff preview has been broken for long time. * Fix the regression for `data-line-num` * `.code-diff` is necessary to show the line number * Fix the regression for #12434 * The diff: [12434](https://github.com/go-gitea/gitea/pull/12434/files?diff=unified&w=1) * It hides the Type(4) (aka HunkHeader) for unexpected cases. Diff with ignoring whitespaces: https://github.com/go-gitea/gitea/pull/23307/files?diff=unified&w=1 Before: see the issue #23265 After: ![image](https://user-images.githubusercontent.com/2114189/222942810-286dc9af-0b39-4e9d-8585-8c299b881241.png)
* [skip ci] Updated translations via CrowdinGiteaBot2023-03-0623-23/+2
|
* Add context when rendering labels or emojis (#23281)Jonathan Tran2023-03-0523-76/+136
| | | | | | | | | | | | This branch continues the work of #23092 and attempts to rid the codebase of any `nil` contexts when using a `RenderContext`. Anything that renders markdown or does post processing may call `markup.sha1CurrentPatternProcessor()`, and this runs `git.OpenRepository()`, which needs a context. It will panic if the context is `nil`. This branch attempts to _always_ include a context when creating a `RenderContext` to prevent future crashes. Co-authored-by: Kyle D <kdumontnu@gmail.com>
* Change interactiveBorder to fix popup preview (#23169)Hester Gong2023-03-051-0/+1
| | | | | | | | | Close #23073. Used the solution as reference to the reply: https://github.com/go-gitea/gitea/issues/23073#issuecomment-1440124609 Here made the change inside the `contextpopup.js` because this is where the popup component is created and tippy configuration is given. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Improve the frontend guideline (#23298)wxiaoguang2023-03-053-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### The CustomEvent prefix There was already `ce-quick-submit`, the `ce-` prefix seems better than `us-`. Rename the only `us-` prefixed `us-load-context-popup` to `ce-` prefixed. ### Styles and Attributes in Go HTML Template https://github.com/go-gitea/gitea/pull/21855#issuecomment-1429643073 Suggest to stick to `class="c1 {{if $var}}c2{{end}}"` The readability and maintainability should be applied to the code which is read by developers, but not for the generated outputs. The template code is the code for developers, while the generated HTML are only for browsers. The `class="c1 {{if $var}}c2{{end}}"` style is clearer for developers and more intuitive, and the generated HTML also makes browsers happy (a few spaces do not affect anything) Think about a more complex case: * `class="{{if $active}}active{{end}} menu item {{if $show}}show{{end}} {{if $warn}}warn{{end}}"` * --vs-- * `class="{{if $active}}active {{end}}menu item{{if $show}} show{{end}}{{if $warn}} warn{{end}}"` The first style make it clearer to see each CSS class name with its `{{if}}` block. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Scoped labels: set aria-disabled on muted Exclusive option for a11y (#23306)Brecht Van Lommel2023-03-051-0/+2
| | | | | | | | | It is convenient to be able to toggle off this option after removing / from the name. This ensures the muted state is communicated to blind users even when the input is not fully disabled. Part of #22974 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add basic documentation for labels, including scoped labels (#23304)Brecht Van Lommel2023-03-051-0/+42
| | | | | | | Part of #22974 --------- Co-authored-by: delvh <dev.lh@web.de>
* [skip ci] Updated translations via CrowdinGiteaBot2023-03-0525-161/+223
|
* Re-add accidentally removed `hacking-on-gitea.zh-cn.md` (#23297)Lunny Xiao2023-03-041-0/+43
| | | | #21627 accidentally removed the docs file `hacking-on-gitea.zh-cn.md`. This re-adds it and merges some changes from #23289
* Add default owner team to privated_org and limited_org in unit test (#23109)yp053272023-03-042-2/+24
| | | | | | | | Related to https://github.com/go-gitea/gitea/pull/22705 's CI result [here](https://drone.gitea.io/go-gitea/gitea/68043/2/16) > IsOrganizationOwner() [E] [63f61849-7] Organization does not have owner team: 23
* Improve sed detection in update-locales.sh (#23254)silverwind2023-03-041-10/+11
| | | | | | | | | | - ~~Make scripts work from any directory~~ - Detect sed version just like Makefile does --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Support sanitising the URL by removing extra slashes in the URL (#21333)Sandeep Bhat2023-03-042-2/+103
| | | | | | | | | | | | | | | | | | | Changes in this PR : Strips incoming request URL of additional slashes (/). For example an input like `https://git.data.coop//halfd/new-website.git` is translated to `https://git.data.coop/halfd/new-website.git` Fixes https://github.com/go-gitea/gitea/issues/20462 Fix #23242 --------- Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Make Ctrl+Enter submit a pending comment (starting review) instead of ↵wxiaoguang2023-03-049-28/+25
| | | | | | | | | | | | | | | | | | submitting a single comment (#23245) Close #23241 Before: press Ctrl+Enter in the Code Review Form, a single comment will be added. After: press Ctrl+Enter in the Code Review Form, start the review with pending comments. The old name `is_review` is not clear, so the new code use `pending_review` as the new name. Co-authored-by: delvh <leon@kske.dev> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Avoid panic caused by broken payload when creating commit status (#23216)Jason Song2023-03-045-14/+45
| | | | | | | | | | | | | | | | | | When creating commit status for Actons jobs, a payload with nil `HeadCommit` will cause panic. Reported at: https://gitea.com/gitea/act_runner/issues/28#issuecomment-732166 Although the `HeadCommit` probably can not be nil after #23215, `CreateCommitStatus` should protect itself, to avoid being broken in the future. In addition, it's enough to print error log instead of returning err when `CreateCommitStatus` failed. --------- Co-authored-by: delvh <dev.lh@web.de>
* Add run status in action view page (#23212)yp053272023-03-042-2/+15
| | | | | | | | | | | | | | | | | Before: ![image](https://user-images.githubusercontent.com/18380374/222084932-a7643fbe-2d9f-48db-b25d-74ace49e03f4.png) ![image](https://user-images.githubusercontent.com/18380374/222084887-fde3500d-dad3-4902-9c82-c4f71f23f83b.png) After: ![image](https://user-images.githubusercontent.com/18380374/222084565-eeef1110-9d9d-40b4-a26b-fbd5a307f14e.png) ![image](https://user-images.githubusercontent.com/18380374/222084728-6c96d7c1-a399-43d5-8369-392ad5017b7f.png) --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* update to mermaid v10 (#23178)techknowlogick2023-03-044-68/+233
| | | | | | | fix #23153 --------- Co-authored-by: silverwind <me@silverwind.io>
* Fix code wrap for unbroken lines (#23268)wxiaoguang2023-03-031-2/+1
| | | | | | | | | | | | | | | | | | | | ## The Problem `overflow-wrap: break-word` doesn't work well for unbroken lines. Use `overflow-wrap: anywhere` instead, and remove legacy alias `word-wrap` ## Before ![image](https://user-images.githubusercontent.com/2114189/222743939-5f38d9e4-18d8-4ae0-8078-4b3a59195a30.png) ## After ![image](https://user-images.githubusercontent.com/2114189/222743833-0e0cfdbb-7b2e-420d-99f9-b1b45dde521a.png) --------- Co-authored-by: silverwind <me@silverwind.io>
* Fix stray backticks appearing in pull request timeline (#23282)Brecht Van Lommel2023-03-031-2/+2
| | | Caused by #23189.
* Fill head commit to in payload when notifying push commits for mirroring ↵Jason Song2023-03-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | (#23215) Just like what has been done when pushing manually: https://github.com/go-gitea/gitea/blob/7a5af25592003ddc3017fcd7b822a3e02fc40ef6/services/repository/push.go#L225-L226 Before: <img width="448" alt="image" src="https://user-images.githubusercontent.com/9418365/222100123-cd4839d1-2d4d-45f7-b7a0-0cbc73162b44.png"> After: <img width="448" alt="image" src="https://user-images.githubusercontent.com/9418365/222100225-f3c5bb65-7ab9-41e2-8e39-9d84c23c352d.png"> --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix various bugs for "install" page (#23194)wxiaoguang2023-03-047-30/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ## TLDR * Fix the broken page / broken image problem when click "Install" * Close #20089 * Fix the Password Hash Algorithm display problem for #22942 * Close #23183 * Close #23184 ## Details ### The broken page / broken image problem when click "Install" (Redirect failed after install gitea #23184) Before: when click "install", all new requests will fail, because the server has been restarted. Users just see a broken page with broken images, sometimes the server is not ready but the user would have been redirect to "/user/login" page, then the users see a new broken page (connection refused or something wrong ...) After: only check InstallLock=true for necessary handlers, and sleep for a while before restarting the server, then the browser has enough time to load the "post-install" page. And there is a script to check whether "/user/login" is ready, the user will only be redirected to the login page when the server is ready. ### During new instance setup make 'Gitea Base URL' filled from window.location.origin #20089 If the "app_url" input contains `localhost` (the default value from config), use current window's location href as the `app_url` (aka ROOT_URL) ### Fix the Password Hash Algorithm display problem for "Provide the ability to set password hash algorithm parameters #22942" Before: the UI shows `pbkdf2$50000$50` <details> ![image](https://user-images.githubusercontent.com/2114189/221917143-e1e54798-1698-4fee-a18d-00c48081fc39.png) </details> After: the UI shows `pbkdf2` <details> ![image](https://user-images.githubusercontent.com/2114189/221916999-97a15be8-2ebb-4a01-bf93-dac18e354fcc.png) </details> ### GET data: net::ERR_INVALID_URL #23183 Cause by empty `data:` in `<link rel="manifest" href="data:{{.ManifestData}}">` --------- Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix GetFilesChangedBetween if the file name may be escaped (#23272)zeripath2023-03-031-2/+9
| | | | | | | | | | | | | The code for GetFilesChangedBetween uses `git diff --name-only base..head` to get the names of files changed between base and head however this forgets that git will escape certain values. This PR simply switches to use `-z` which has the `NUL` character as the separator. Ref https://github.com/go-gitea/gitea/pull/22568#discussion_r1123138096 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Support paste treepath when creating a new file or updating the file name ↵Hester Gong2023-03-031-28/+38
| | | | | | | | | | | | | | (#23209) Close #23204 Quick Demo: https://user-images.githubusercontent.com/17645053/222058727-ad30a37c-f0ac-4184-9946-a71fcee473b5.mov --------- Co-authored-by: delvh <leon@kske.dev>
* Fix grammar in error message (#23273)ChristianSch2023-03-031-1/+1
| | | | Fixes the grammar in the error message in case a runner token has already been activated
* Revert relative links to absolute links in mail templates (#23267)wxiaoguang2023-03-033-6/+6
| | | | | Follow #21986 , fix regression. The mail templates should always use `AppURL` (the full absolute URL)
* Fix cannot reopen after pushing commits to a closed PR (#23189)sillyguodong2023-03-036-17/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Close: #22784 1. On GH, we can reopen a PR which was closed before after pushing commits. After reopening PR, we can see the commits that were pushed after closing PR in the time line. So the case of [issue](https://github.com/go-gitea/gitea/issues/22784) is a bug which needs to be fixed. 2. After closing a PR and pushing commits, `headBranchSha` is not equal to `sha`(which is the last commit ID string of reference). If the judgement exists, the button of reopen will not display. So, skip the judgement if the status of PR is closed. ![image](https://user-images.githubusercontent.com/33891828/222037529-651fccf9-0bba-433e-b2f0-79c17e0cc812.png) 3. Even if PR is already close, we should still insert comment record into DB when we push commits. So we should still call function `CreatePushPullComment()`. https://github.com/go-gitea/gitea/blob/067b0c2664d127c552ccdfd264257caca4907a77/services/pull/pull.go#L260-L282 So, I add a switch(`includeClosed`) to the `GetUnmergedPullRequestsByHeadInfo` func to control whether the status of PR must be open. In this case, by setting `includeClosed` to `true`, we can query the closed PR. ![image](https://user-images.githubusercontent.com/33891828/222621045-bb80987c-10c5-4eac-aa0c-1fb9c6aefb51.png) 4. In the loop of comments, I use the`latestCloseCommentID` variable to record the last occurrence of the close comment. In the go template, if the status of PR is closed, the comments whose type is `CommentTypePullRequestPush(29)` after `latestCloseCommentID` won't be rendered. ![image](https://user-images.githubusercontent.com/33891828/222058913-c91cf3e3-819b-40c5-8015-654b31eeccff.png) e.g. 1). The initial status of the PR is opened. ![image](https://user-images.githubusercontent.com/33891828/222453617-33c5093e-f712-4cd6-8489-9f87e2075869.png) 2). Then I click the button of `Close`. PR is closed now. ![image](https://user-images.githubusercontent.com/33891828/222453694-25c588a9-c121-4897-9ae5-0b13cf33d20b.png) 3). I try to push a commit to this PR, even though its current status is closed. ![image](https://user-images.githubusercontent.com/33891828/222453916-361678fb-7321-410d-9e37-5a26e8095638.png) But in comments list, this commit do not display.This is as expected :) ![image](https://user-images.githubusercontent.com/33891828/222454169-7617a791-78d2-404e-be5e-77d555f93313.png) 4). Click the `Reopen` button, the commit which is pushed after closing PR display now. ![image](https://user-images.githubusercontent.com/33891828/222454533-897893b6-b96e-4701-b5cb-b1800f382b8f.png) --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Use correct README link to render the README (#23152)yp053272023-03-037-2/+23
| | | | | | | | | | | | | | | | | | | | | | | `renderReadmeFile` needs `readmeTreelink` as parameter but gets `treeLink`. The values of them look like as following: `treeLink`: `/{OwnerName}/{RepoName}/src/branch/{BranchName}` `readmeTreelink`: `/{OwnerName}/{RepoName}/src/branch/{BranchName}/{ReadmeFileName}` `path.Dir` in https://github.com/go-gitea/gitea/blob/8540fc45b11eff9a73753ca139f8ea5c38509bf5/routers/web/repo/view.go#L316 should convert `readmeTreelink` into `/{OwnerName}/{RepoName}/src/branch/{BranchName}` instead of the current `/{OwnerName}/{RepoName}/src/branch`. Fixes #23151 --------- Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
* Add document for `webcomponents` (#23261)wxiaoguang2023-03-031-0/+19
|
* Use async await to fix empty quote reply at first time (#23168)HesterG2023-03-023-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | The reason why quote reply is empty is when quote reply is clicked, it triggers the click function on `.comment-form-reply` button, and when the first time this function is triggered, easyMDE for the reply has not yet initialized, so that click handler of `.quote-reply` button in `repo-legacy.js` got an `undefined` as easyMDE, and the following lines which put quoted reply into the easyMDE is not executed. The workaround in this PR is to pass the replied content to '.comment-form-reply' button if easyMDE is not yet initialized (quote reply first clicked) and put the replied content into it the after easyMDE is created. Now quote reply on first click: https://user-images.githubusercontent.com/17645053/221452823-fc699d50-1649-4af1-952e-f04fc8d2978e.mov <br /> Update: The above change is not appropriate as stated in the [comment](https://github.com/go-gitea/gitea/pull/23168#issuecomment-1445562284) Use await instead Close #22075. Close #23247.
* Fix switched citation format (#23250)Blender Defender2023-03-021-1/+1
| | | | | Due to switched input parameters, the citation texts for Bibtex and Apa were switched. This pull request fixes #23244
* Improve update-locales script and fix locale processing bug (#23240)wxiaoguang2023-03-022-13/+225
| | | | | | | | | | | | | | | | | The locales of Gitea has been broken for long time, till now, it's still not fully fixed. One of the root problems is that the `ini` library is quite quirky and the `update-locales` script doesn't work well for all cases. This PR fixes the `update-locales` script to make it satisfy `ini` library and the crowdin. See the comments for more details. The `locale_zh-CN.ini` is an example, it comes from crowdin and is processed by the new `update-locales.sh`. Especially see the `feed_of`: https://github.com/go-gitea/gitea/pull/23240/files#diff-321f6ca4eae1096eba230e93c4740f9903708afe8d79cf2e57f4299786c4528bR268
* Refactor `ctx` in templates (#23105)wxiaoguang2023-03-0212-51/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, the `dict "ctx" ...` map is used to pass data between templates. Now, more and more templates need to use real Go context: * #22962 * #23092 `ctx` is a Go concept for `Context`, misusing it may cause problems, and it makes it difficult to review or refactor. This PR contains 2 major changes: * In the top scope of a template, the `$` is the same as the `.`, so the old labels_sidebar's `root` is the `ctx`. So this `ctx` could just be removed. https://github.com/go-gitea/gitea/commit/bd7f218dce01e0fb661b23b55995f5d51b4530e8 * Rename all other `ctx` to `ctxData`, and it perfectly matches how it comes from backend: `"ctxData": ctx.Data`. https://github.com/go-gitea/gitea/pull/23105/commits/7c01260e1df1dcb052e1cf86ebe982bf77c4407f From now on, there is no `ctx` in templates. There are only: * `ctxData` for passing data * `Context` for Go context