1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00
forgejo/models/issues
forgejo-backport-action 118762dd6d [v8.0/forgejo] fix(UI): issue task list numbers, fix #4431 (#4735)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/4452

## Regexp fixes
This fixes #4431 by adjusting the related regular expressions. Also it allows to have multiple spaces between `-` or `*` and the following brackets.

Related is the following gitea PR: https://github.com/go-gitea/gitea/pull/3296. I wonder a bit why the author stated
> Also fixed the requirement for one character after the blank of - [ ] .

I don't see a reason why
```
- [x]
some task
```
shall not be a valid checkbox without any character after the `]`. E.g., this would render to
- [x]
some task

The third commit fixes this issue.

### Comments
- I wonder a bit why the regexp is written in such complicated way and if
  ```diff
  - (^\s*[-*]\s*\[[\sxX]\])|(
\s*[-*]\s*\[[\sxX]\])
  + (^|
)\s*[-*]\s*\[[\sxX]\]
  ```
  would work the same way. Edit: I tried and indeed the second regex works as expected.
- ~~Why it is actually matching the `\s` and not just the space (` `)? (but OK, no big issue)~~ Edit: `[\t]` is also allowed. Keep it!
- Check boxes in code blocks are counted as well, but I think that this is an edge case which is not a big issue as well.

### Before
![before](https://codeberg.org/attachments/cb4f879d-cdd2-4814-aed2-5de8b5437fb2)
### After
![after](https://codeberg.org/attachments/5d54648f-dd73-4577-9a80-729016219093)

## Javascript fixes
Additionally, while testing I figured out, that currently checkboxes with capital `X` like
```
- [X] another task
```
- [X] another task

cannot be unchecked. Thus, the second commit fixes that issue as well.

## Checklist

The [developer guide](https://forgejo.org/docs/next/developer/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Co-authored-by: Robert Wolff <mahlzahn@posteo.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4735
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-07-31 14:16:11 +00:00
..
assignees.go Performance improvements for pull request list API (#30490) 2024-06-02 16:26:54 +02:00
assignees_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
comment.go Prevent simultaneous editing of comments and issues (#31053) 2024-06-02 16:26:54 +02:00
comment_code.go Do some performance optimize for issues list and view issue/pull (gitea#29515) 2024-04-08 14:47:31 +02:00
comment_list.go fix: never set Poster or Assignee to nil 2024-07-29 14:32:57 +00:00
comment_list_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
comment_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
content_history.go [BUG] Ensure HasIssueContentHistory takes into account comment_id 2024-02-29 18:23:06 +01:00
content_history_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
dependency.go Penultimate round of db.DefaultContext refactor (#27414) 2023-10-11 04:24:07 +00:00
dependency_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
issue.go [v8.0/forgejo] fix(UI): issue task list numbers, fix #4431 (#4735) 2024-07-31 14:16:11 +00:00
issue_index.go Do not update PRs based on events that happened before they existed 2024-04-11 11:16:23 +02:00
issue_index_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
issue_label.go Performance improvements for pull request list API (#30490) 2024-06-02 16:26:54 +02:00
issue_label_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
issue_list.go fix: never set Poster or Assignee to nil 2024-07-29 14:32:57 +00:00
issue_list_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
issue_lock.go Penultimate round of db.DefaultContext refactor (#27414) 2023-10-11 04:24:07 +00:00
issue_project.go Rename project board -> column to make the UI less confusing (#30170) 2024-06-02 09:42:39 +02:00
issue_search.go Optimization of labels handling in issue_search (#4228) 2024-06-28 05:11:57 +00:00
issue_stats.go Fix bug in GetIssueStats 2024-06-13 10:25:26 +02:00
issue_stats_test.go Run make fmt 2024-06-16 15:59:59 +02:00
issue_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
issue_update.go Prevent simultaneous editing of comments and issues (#31053) 2024-06-02 16:26:54 +02:00
issue_user.go Add combined index for issue_user.uid and issue_id (#28080) 2023-12-14 09:26:59 +00:00
issue_user_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
issue_watch.go Even more db.DefaultContext refactor (#27352) 2023-10-03 10:30:41 +00:00
issue_watch_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
issue_xref.go [CLEANUP] make golangci-lint@v1.56.1 happy 2024-02-15 16:19:36 +01:00
issue_xref_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
label.go Optimization of labels handling in issue_search (#4228) 2024-06-28 05:11:57 +00:00
label_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
main_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
milestone.go remove util.OptionalBool and related functions (#29513) 2024-03-06 12:10:46 +08:00
milestone_list.go remove util.OptionalBool and related functions (#29513) 2024-03-06 12:10:46 +08:00
milestone_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
pull.go Make gitea webhooks openproject compatible (gitea#28435) 2024-06-05 15:58:51 +02:00
pull_list.go Fix PullRequestList.GetIssueIDs's logic (#31352) 2024-06-16 13:42:58 +02:00
pull_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
reaction.go Add container.FilterSlice function (gitea#30339) 2024-04-16 11:49:44 +02:00
reaction_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
review.go Fix automerge will not work because of some events haven't been triggered (#30780) 2024-05-26 19:01:36 +02:00
review_list.go Add container.FilterSlice function (gitea#30339) 2024-04-16 11:49:44 +02:00
review_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
stopwatch.go Remove deadcode under models/issues (#28536) 2023-12-19 20:12:02 +01:00
stopwatch_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00
tracked_time.go Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
tracked_time_test.go enable linter testifylint on v8 (#4573) 2024-07-30 19:41:27 +00:00