Commit Graph

17699 Commits

Author SHA1 Message Date
silverwind 226a82a939
Migrate font-family to tailwind (#30118)
Enable us to use tailwind's
[`font-family`](https://tailwindcss.com/docs/font-family) classes as
well as remove `gt-mono` in favor of `tw-font-mono`. I also merged the
"compensation" to one selector, previously this was two different values
0.9em and 0.95em. I did not declare a `serif` font because I don't think
there will ever be a use case for those. Command ran:

```sh
perl -p -i -e 's#gt-mono#tw-font-mono#g' web_src/js/**/* templates/**/*
2024-03-28 08:31:07 +00:00
YR Chen 7443a10fc3
Move from `max( id )` to `max( index )` for latest commit statuses (#30076)
This PR replaces the use of `max( id )`, and instead using ``max(
`index` )`` for determining the latest commit status. Building business
logic over an `auto_increment` primary key like `id` is risky and
there’re already plenty of discussions on the Internet.

There‘s no guarantee for `auto_increment` values to be monotonic,
especially upon failures or with a cluster. In the specific case, we met
the problem of commit statuses being outdated when using TiDB as the
database. As [being
documented](https://docs.pingcap.com/tidb/stable/auto-increment),
`auto_increment` values assigned to an `insert` statement will only be
monotonic on a per server (node) basis.

Closes #30074.
2024-03-28 16:01:15 +08:00
delvh 0d5abe3454
Remember login for a month by default (#30150)
Previously, the default was a week.
As most instances don't set the setting, this leads to a bad user
experience by default.

## ⚠️ Breaking

If your instance requires a high level of security,
you may want to set `[security].LOGIN_REMEMBER_DAYS` so that logins are
not valid as long.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
2024-03-28 03:13:42 +00:00
HEREYUA 7ba485bd49
Apply to become a maintainer (#30151)
PRs:https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3AHEREYUA+is%3Aclosed

Discord: hereyua
2024-03-28 02:47:05 +00:00
wxiaoguang 71706126b5
Refactor markdown render (#30139)
Only split the file into small ones (and rename AttentionTypes to
attentionTypes)
2024-03-28 02:26:13 +00:00
silverwind 7fda109aba
Drag-and-drop improvements for projects and issue pins (#29875)
1. Add "grabbing" cursor while dragging items:


![](https://github.com/go-gitea/gitea/assets/115237/c60845ff-7544-4215-aeaa-408e8c4ef03a)

2. Make project board only drag via their header, not via their whole
body.


![](https://github.com/go-gitea/gitea/assets/115237/62c27f3d-993a-481d-9cc3-b6226b4c5d61)

3. Fix some cursor problems in projects
4. Move shared options into `createSortable`.
2024-03-28 00:20:38 +01:00
silverwind b08c7afe5f
Fix table alignment classes (#30144)
Fixes https://github.com/go-gitea/gitea/issues/30142, regression from
https://github.com/go-gitea/gitea/pull/30047. I searched the codebase
and only `bottom aligned` was definitely not in use so I removed it.
2024-03-27 21:47:40 +00:00
Denys Konovalov e5160185ed
Add default board to new projects, remove uncategorized pseudo-board (#29874)
On creation of an empty project (no template) a default board will be
created instead of falling back to the uneditable pseudo-board.

Every project now has to have exactly one default boards. As a
consequence, you cannot unset a board as default, instead you have to
set another board as default. Existing projects will be modified using a
cron job, additionally this check will run every midnight by default.

Deleting the default board is not allowed, you have to set another board
as default to do it.

Fixes #29873
Fixes #14679 along the way
Fixes #29853

Co-authored-by: delvh <dev.lh@web.de>
2024-03-27 20:54:32 +00:00
silverwind 4eb86d6823
Fix loading spinner on ContextPopup (#30145)
Fix regression from https://github.com/go-gitea/gitea/pull/26670. Here
with simulated delay:


![](https://github.com/go-gitea/gitea/assets/115237/9de5a136-c8a6-4d69-adc7-07e1184e3311)
2024-03-27 20:18:04 +00:00
silverwind c85619b82d
Fix download buttons on branches page (#30147)
Fixes https://github.com/go-gitea/gitea/issues/30143, regression from
https://github.com/go-gitea/gitea/pull/29920.

We have `.button` on the repo page, but on the branch page it's a
`.btn`. Eventually we should find a solution to have a single button
class but until then this solution should be acceptable.
2024-03-27 21:05:49 +01:00
wxiaoguang 1ad48f781e
Relax generic package filename restrictions (#30135)
Now, the chars `=:;()[]{}~!@#$%^ &` are possible as well
Fixes #30134

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-03-27 16:55:05 +00:00
Yarden Shoham 1551d73d3f
Remove jQuery class from the common admin functions (#30137)
- Switched from jQuery class functions to plain JavaScript `classList`
- Tested the new authentication source form and the deletion of system
notices. They work as before

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-27 16:14:18 +00:00
Yarden Shoham 1a71dbfb78
Remove jQuery class from the reaction selector (#30138)
- Switched from jQuery class functions to plain JavaScript `classList`
- Tested the reaction selector and it works as before

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-27 17:09:34 +01:00
Yarden Shoham 34acd8e376
Forbid jQuery `.attr` (#30116)
Use `.getAttribute`, `.setAttribute`, or `.removeAttribute` instead

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-03-27 21:49:54 +08:00
wxiaoguang f1707f4562
Refactor render (#30136) 2024-03-27 13:14:34 +00:00
HEREYUA 0262c66ba6
Fix: Organization Interface Display Issue (#30133)
**Before**

![image](https://github.com/go-gitea/gitea/assets/37935145/88d04a4b-6dc5-4399-9813-2c339eae3722)

**After**

![image](https://github.com/go-gitea/gitea/assets/37935145/e97a64b8-ea24-4de7-992d-5928888872d0)
2024-03-27 12:48:09 +00:00
Yarden Shoham 0922ce8191
Remove jQuery `.attr` from the Fomantic dropdowns (#30114)
- Switched from jQuery `attr` to plain javascript `getAttribute` and
`setAttribute`
- Tested the dropdowns and they work as before

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-27 10:50:07 +00:00
Yarden Shoham a190f68f1b
Remove jQuery `.attr` from the common admin functions (#30115)
- Switched from jQuery `attr` to plain javascript `getAttribute` and
`setAttribute`
- Tested most of the functions and they work as before

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-27 10:45:05 +00:00
Yarden Shoham 4efe7884a3
Remove jQuery from the create/rename branch modals (except Fomantic) (#30109)
- Switched to plain JavaScript
- Tested the create/rename branch modals' functionality and they work as
before

# Demo using JavaScript without jQuery

![demo](https://github.com/go-gitea/gitea/assets/20454870/ca53155e-856e-44ca-9852-12ff60065735)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-27 11:40:21 +01:00
silverwind 643e6b0958
Remove fomantic label module (#30081)
Of note is the CSS has references to "floating label" and "transparent
label" but I could not find those anywhere in the code. They are related
to https://github.com/go-gitea/gitea/pull/3939, but I think these have
long been removed.

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-27 09:58:02 +00:00
Lunny Xiao 400bb7ced4
Fix bug for markdown rendering of blockquote (#30130)
Caused by #29984

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-27 17:09:25 +08:00
HEREYUA 4640441a0e
Fix: The interface is broken when modifying code comments under mobile devices (#30125)
**Fix**: [#30123](https://github.com/go-gitea/gitea/issues/30123)

**Before**

![image](https://github.com/go-gitea/gitea/assets/37935145/2a186399-85b0-480a-b2f9-f4feffd9a8e2)


**After**

![image](https://github.com/go-gitea/gitea/assets/37935145/ce1ce3e4-3bbb-4a4b-b0e7-e7943a0774f2)
2024-03-27 08:13:12 +00:00
HEREYUA 1261dd6742
When the title in the issue has a value, set the text cursor at the end of the text. (#30090)
Fix:  [#25055](https://github.com/go-gitea/gitea/issues/25055)

Before

![image](https://github.com/go-gitea/gitea/assets/37935145/1b89cd7b-4fa3-49aa-9b5e-a8413add436e)

After

![image](https://github.com/go-gitea/gitea/assets/37935145/fa808f8d-d3ce-4245-a4fe-dd0282ba3fdf)

ps: I've noticed that we are gradually replacing jQuery, so I didn't use jQuery here.
2024-03-27 15:20:10 +08:00
yp05327 ce3c351226
Load attachments for code comments (#30124)
Fix #30103

ps: comments has `LoadAttributes`, but maybe considering performance
problem, we don't call it.
2024-03-27 04:44:26 +00:00
silverwind a9e5706696
Upgrade fabric to 6.0.0-beta20 (#30121)
Fixes https://github.com/go-gitea/gitea/issues/29326 because it includes
https://github.com/fabricjs/fabric.js/pull/9707.
2024-03-27 04:17:14 +00:00
silverwind 57539bcdc0
Fix click handler in job-step-summary (#30122)
Fix mistake from https://github.com/go-gitea/gitea/pull/29977 where the
click handler wasn't updated for the change with the `isExpandable`
function.
2024-03-27 03:50:24 +00:00
Lunny Xiao 538790ad1d
Put an edit file button on pull request files to allow a quick operation (#29697)
Resolve #23848

This PR put an edit file button on pull request files to allow a quick
edit for a file. After the edit finished, it will return back to the
viewed file position on pull request files tab.

It also use a branch view file link instead of commit link when it's a
non-commit pull request files view.

<img width="1532" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/3637ca4c-89d5-4621-847b-79702a44f617">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2024-03-27 02:34:10 +00:00
Yarden Shoham f47e00d9d3
Remove jQuery `.attr` from the Fomantic modal cancel buttons (#30113)
- Switched from jQuery `attr` to plain javascript `setAttribute`
- Tested the modals and they work as before

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-03-26 19:57:57 +00:00
Yarden Shoham 5687aca4fc
Remove jQuery `.attr` from the code comments (#30112)
- Switched from jQuery `attr` to plain javascript `getAttribute`
- Tested the code comments and they work as before

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-26 20:49:38 +01:00
Yarden Shoham a1f11e2e33
Remove jQuery calls that have no effect on `showElem` and `hideElem` (#30110)
There's no need to initialize a jQuery object with a CSS selector when
we can pass the CSS selector directly.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-03-26 19:38:37 +00:00
Yarden Shoham e0b018706f
Remove jQuery `.attr` from the common issue page functions (#30083)
- Switched from jQuery `attr` to plain javascript `getAttribute` and
`setAttribute`
- Tested most of the functions and they work as before

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
2024-03-26 20:33:32 +01:00
silverwind 30a561ce56
Restore aligned grid column CSS (#30106)
Fixes #30097, regression from #29894.
2024-03-26 15:37:14 +00:00
Lunny Xiao 0c8b828f5d
Fix possible data race on tests (#30093) 2024-03-26 14:08:30 +00:00
silverwind 2ab5f05f40
Add svg linter and fix incorrect svgs (#30086)
Fixes https://github.com/go-gitea/gitea/issues/30082.

Adds a new linter that searches for non-existant SVG images in
templates. Output before the fix was:

```
$ make lint-templates
SVG "octicon-warning" not found, used in templates/devtest/flex-list.tmpl
SVG "octicon-warning" not found, used in templates/devtest/flex-list.tmpl
SVG "octicon-markup" not found, used in templates/repo/diff/comment_form.tmpl
make: *** [Makefile:438: lint-templates] Error 1
```

<img width="306" alt="Screenshot 2024-03-25 at 23 31 05"
src="https://github.com/go-gitea/gitea/assets/115237/1052d1a9-bfec-4d5a-9cae-f895f78f7c93">
2024-03-26 11:19:15 +00:00
yp05327 274bc00ca2
Fix duplicate migrated milestones (#30102)
Fix #17567
2024-03-26 10:20:26 +00:00
silverwind c1ac721508
Update JS any PY dependencies, remove workarounds (#30085)
- Update dependencies via `make update-js update-py svg`
- Remove `postcss` workaround -
https://github.com/postcss/postcss/issues/1914
- Remove `happy-dom` workaround -
https://github.com/capricorn86/happy-dom/pull/1365.
- Tested Katex and Asciinema
2024-03-26 09:41:40 +00:00
yp05327 9cf0f0bb04
Fix gitea doctor will remove repo-avatar files when execute command `storage-archives` (#30094)
Fix #30037
2024-03-26 08:24:13 +00:00
silverwind a4455d313e
Fix alignment in actions right view (#29979)
Fixes: https://github.com/go-gitea/gitea/issues/29974, Regression from
https://github.com/go-gitea/gitea/pull/29640.

Depending on the number of steps on the left side, the right side will
vertically expand. Collapse it with `align-self`.

<img width="1308" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/9bcede9c-d869-4f3f-8a10-026c74c03f71">
2024-03-26 07:56:44 +00:00
crazeteam ecbc9cee2b
Remove repetitive words (#30091)
remove repetitive words

Signed-off-by: crazeteam <lilujing@outlook.com>
2024-03-26 15:48:53 +08:00
silverwind dd75237c34
Fix table header text-align (#30084)
Fix regression from https://github.com/go-gitea/gitea/pull/30047.
Apparently tables have certain user-agent styles that center inside
`<th>` etc. Restored the original fomantic rules for these.

Before:
<img width="1332" alt="Screenshot 2024-03-25 at 21 59 33"
src="https://github.com/go-gitea/gitea/assets/115237/e06a5509-b505-4752-9b6e-91d5ed49f61d">

After:
<img width="1330" alt="Screenshot 2024-03-25 at 21 59 40"
src="https://github.com/go-gitea/gitea/assets/115237/6444817f-dd61-4a1e-a8b3-959c2780148d">
2024-03-26 06:50:04 +00:00
yp05327 08aec2c20a
Fix panic for `fixBrokenRepoUnits16961` (#30068)
![image](https://github.com/go-gitea/gitea/assets/18380374/508b3ceb-f53d-4d3b-a781-97c1542af1cb)
2024-03-26 14:45:11 +08:00
silverwind bcb151c220
Enable eslint `space-before-function-paren` (#30078)
Anonymous are set to ignore as I [couldn't
decide](https://github.com/go-gitea/gitea/pull/30077#discussion_r1538117497).
No current violations.

Rule docs: https://eslint.style/rules/js/space-before-function-paren
2024-03-25 23:14:17 +00:00
Yarden Shoham a9a5734185
Remove jQuery `.attr` from the code line range selection (#30077)
- Switched from jQuery `attr` to plain javascript `getAttribute` and
`setAttribute`
- Tested the code line range selection and it works as before

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
2024-03-25 23:03:12 +00:00
yp05327 13921569dd
Add muted class to author name in repo commit list (#29989)
Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/f6b3728c-ed9a-4e47-8755-89373235dff2)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/272c85e3-620d-4758-ae4d-ad90b54e142c)

If repo is a mirror, external user's name will be white, but if user is
existed, then you will see blue names and white names together:

![image](https://github.com/go-gitea/gitea/assets/18380374/747622da-56e3-4162-b391-919787a8cee4)

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-03-25 20:18:58 +00:00
silverwind 8fe26fb314
Refactor all `.length === 0` patterns in JS (#30045)
This pattern comes of often during review, so let's fix it once and for
all. Did not test, but changes are trivial enough imho.
2024-03-25 18:37:55 +00:00
silverwind f73d891fc4
Remove fomantic table module (#30047)
Big CSS module. I tested basic functionality on admin and commits table.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-25 16:40:50 +01:00
silverwind 8717c1c2be
Fix menu buttons in issues and release (#30056)
Fix regression from https://github.com/go-gitea/gitea/pull/30033

These buttons had lost their border because `.ui.header` sets `none` but
`.ui.menu` has it, after the migration, the order of styles changed and
header won. I see no reason why those have the `header` class in first
place, besides for semantic meaning.

Before:
<img width="491" alt="Screenshot 2024-03-25 at 00 39 27"
src="https://github.com/go-gitea/gitea/assets/115237/fa1b7505-75cf-4854-a97f-db3c46f31e93">

After:
<img width="496" alt="Screenshot 2024-03-25 at 00 39 14"
src="https://github.com/go-gitea/gitea/assets/115237/8f6bdc07-9596-436b-8c82-9af283300004">
2024-03-25 13:52:54 +00:00
wxiaoguang 8e79aed573
Fix git grep search limit, add test (#30071)
Fix #30069
2024-03-25 21:25:22 +08:00
silverwind bbaf62589f
Fix button hover border (#30048)
Fix regression from https://github.com/go-gitea/gitea/pull/30014. The
rule was to broad and affecting things like `primary` button
unintentionally.
2024-03-25 10:14:43 +00:00
Lunny Xiao 475b6e839c
Fix Add/Remove WIP on pull request title failure (#29999)
Fix #29997
2024-03-25 15:51:23 +08:00