Commit graph

9283 commits

Author SHA1 Message Date
L0veSunshine 08208cdfb8
Fix forked repo has no icon and language stat. (#10791)
* Update header.tmpl

* Update _repository.less

* Update pull.go

* Update indexer.go

* Update pull.go

* Update pull.go

* Update indexer.go

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

Thanks the advice from lunny and 6543.

* fix forked repo doesn't have language stat

Modified as suggested by 6543.

* fix forked repo doesn't have language stat

simplify the function.

* fix forked repo doesn't have language stat

update the indexer after the loop

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-04-08 15:13:04 +03:00
j.yao.SUSE b40107c416
[suggest] change merge strategy: do not check write access if user in merge white list (#10951)
* [suggest] change merge strategy: do not check write access if user in merge white list #10935

(cherry picked from commit ba74fc6389dfcad03c273441a49b54e4d38c86ee)

* fix NPE

* Fix cross compile (#10952)

* Fix cross compile

* Add test for cross compile

* Fix drone

* Fix drone

* Also prevent CC environment not to generate

Co-authored-by: zeripath <art27@cantab.net>

* fix merge box icon color bug (#10974)

that because need some space beturn ``text`` and color defines

Signed-off-by: a1012112796 <1012112796@qq.com>

* [skip ci] Updated translations via Crowdin

* Allow X in addition to x in tasks (#10979)

Signed-off-by: Andrew Thornton <art27@cantab.net>

* remove api: merge  reqRepoWriter

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 赵智超 <1012112796@qq.com>
Co-authored-by: GiteaBot <teabot@gitea.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-08 14:26:50 +03:00
zeripath 089b34858c
Return error for authorized_keys and mergebase problems (#10990)
Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-04-08 02:04:19 -03:00
6543 3d63caa542
[API] Get a single commit via Ref (#10915)
* GET /repos/:owner/:repo/commits/:ref

* add Validation Checks

* Fix & Extend TEST

* add two new tast cases
2020-04-07 22:54:46 -04:00
6543 71979d9663
Automatically remove Watches, Assignments, etc if user loses access due to being removed as collaborator or from a team (#10997)
* remove a user from being assigned to any issue/PR if (s)he is removed as a collaborator

* fix gender specific comment

* do not remove users that still have access to the repo if they are a member of a team that can access the repo

* add context to errors

* updates

* incorporate review fixes

* Update models/repo_collaboration.go

Co-Authored-By: 6543 <6543@obermui.de>

* Update models/repo_collaboration.go

Co-Authored-By: 6543 <6543@obermui.de>

* Fix Rebase Relict

* Fix & Impruve

* use xorm builder

* all in one session

* generalize reconsiderIssueAssignees

* Only Unwatch if have no access anymore

* prepare for reuse

* Same things if remove User from Team

* fix lint

* let mysql take time to react

* add description

* CI.restart()

* CI.restart()

Co-authored-by: Lanre Adelowo <yo@lanre.wtf>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-04-07 22:52:01 +01:00
techknowlogick d00ebf445b
upgrade to most recent bluemonday (#11007)
* upgrade to most recent bluemonday

* make vendor

* update tests for bluemonday

* update tests for bluemonday

* update tests for bluemonday
2020-04-07 23:08:47 +03:00
GiteaBot 4c54477bb5 [skip ci] Updated translations via Crowdin 2020-04-07 11:04:55 +00:00
silverwind d6741de934
tweak code tags in markdown (#11000)
- remove whitespace before and after
- increase horizontal padding
- make blocks more apparant on arc-green
2020-04-07 12:03:49 +01:00
Mura Li 514e269b1d
Support running subtests manually (#10988)
Since GNU Make does not allow '/' in the target patterns,
we tranlate the subsequent '.' into '/' for "go test -run".

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-07 01:31:11 -03:00
Michael Kuhn ecb176851b
Fix Ctrl-Enter shortcut for issues (#10986)
The js-quick-submit class needs to be applied to SimpleMDE's input
field, which is currently only done for wiki pages.

Fixes #10937

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-07 00:51:21 -03:00
j.yao.SUSE b252b23f16
[feature] provide OwnerName field for README template (#10981)
Co-Authored-By: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-04-06 21:40:38 -04:00
6543 17837986f0
[Docs] Add Note to Readme-Template about Variable Espansion (#10983)
* add note with Espansion VarNames

* add context of Name
2020-04-06 19:43:17 -04:00
GiteaBot d79ff1dd32 [skip ci] Updated translations via Crowdin 2020-04-06 20:20:08 +00:00
zeripath 856030c530
Add docs for gmail (#10995)
Fix #10971

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-04-06 16:18:42 -04:00
6543 ad31d6b5e8
Fix release counter on API repository info (#10968)
Use the same mechanism as the webpage for calculating the release count

Fix #10946
2020-04-06 19:42:30 +01:00
赵智超 ef89e75d0e
add request review from specific reviewers feature in pull request (#10756)
* add request review feature in pull request

add a way to notify specific reviewers to review like github , by add  or delet a  special type
review . The acton is  is similar to Assign ,  so many code reuse the function and items of
Assignee, but the meaning and result is different.

The Permission style is is similar to github, that only writer can add a review request from Reviewers,
but the poster can recall and remove a review request after a reviwer has revied even if he don't have
Write Premission. only manager , the poster and reviewer of a request review can remove it.

The reviewers can be requested to review contain all readers for private repo , for public, contain
all writers and watchers.

The offical Review Request will block merge if Reject can block it.

an other change: add ui otify for Assignees.

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>

Signed-off-by: a1012112796 <1012112796@qq.com>

* new change

* add placeholder string

* do some changes follow #10238 to add review requests num on lists also
change icon for review requests to eye

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-04-06 19:33:34 +03:00
赵智超 88c14326b1
Users should not be able to prohibit their own login (#10970)
* ui: limit managers prohibit themself to login

Because I think it's crazy and not reasonale , that if a user can
prohibit themself to login. so suggest limit this choice on ui

Signed-off-by: a1012112796 <1012112796@qq.com>

* skip self Prohibit Login in post event handle

* fix comment

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-06 10:23:15 -04:00
zeripath 1bec60e02a
Change default charset for MySQL on install to utf8mb4 (#10989)
Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-06 09:33:15 -04:00
zeripath d26885e2bf
Mulitple Gitea Doctor improvements (#10943)
* Add `gitea doctor --list` flag to list the checks that will be run, including those by default
* Add `gitea doctor --run` to run specific checks
* Add `gitea doctor --all` to run all checks
* Add db version checker
* Add non-default recalculate merge bases check/fixer to doctor
* Add hook checker (Fix #9878) and ensure hooks are executable (Fix #6319)
* Fix authorized_keys checker - slight change of functionality here because parsing the command is fragile and we should just check if the authorized_keys file is essentially the same as what gitea would produce. (This is still not perfect as order matters - we should probably just md5sum the two files.)
* Add SCRIPT_TYPE check (Fix #10977)
* Add `gitea doctor --fix` to attempt to fix what is possible to easily fix
* Add `gitea doctor --log-file` to set the log-file, be it a file, stdout or to switch off completely. (Fixes previously undetected bug with certain xorm logging configurations - see @6543 comment.)

Signed-off-by: Andrew Thornton <art27@cantab.net>
2020-04-06 11:44:47 +01:00
John Olheiser 1648bf2b60
Turn off go modules for xgo and gxz (#10963)
* Turn off go modules for xgo and gxz

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add test release for PR

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Try with go modules off

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Revert Makefile, force a release test

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Turn on GOPROXY for release

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* CI

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* CI

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Final commit

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-04-06 12:48:55 +08:00
Gary Kim 561e7a9a59
Migrate ActivityHeatmap to Vue SFC (#10953)
* Migrate ActivityHeatmap to Vue SFC

Signed-off-by: Gary Kim <gary@garykim.dev>

* Readd vue compiler alias

Signed-off-by: Gary Kim <gary@garykim.dev>

* Remove unneeded use of v-html

Signed-off-by: Gary Kim <gary@garykim.dev>

Co-authored-by: zeripath <art27@cantab.net>
2020-04-06 09:31:11 +08:00
zeripath ca33a95778
Allow X in addition to x in tasks (#10979)
Signed-off-by: Andrew Thornton <art27@cantab.net>
2020-04-05 17:39:05 -05:00
GiteaBot f072d4566f [skip ci] Updated translations via Crowdin 2020-04-05 17:02:59 +00:00
赵智超 9814dd68ad
fix merge box icon color bug (#10974)
that because need some space beturn ``text`` and color defines

Signed-off-by: a1012112796 <1012112796@qq.com>
2020-04-05 20:01:12 +03:00
Lunny Xiao 686850e21f
Fix cross compile (#10952)
* Fix cross compile

* Add test for cross compile

* Fix drone

* Fix drone

* Also prevent CC environment not to generate

Co-authored-by: zeripath <art27@cantab.net>
2020-04-05 20:28:18 +08:00
John Olheiser baadb51445
Add gitea-vet (#10948)
* Add copyright

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add gitea-vet and fix non-compliance

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Combine tools.go into build.go and clean up

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Remove extra GO111MODULE=on

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-04-05 07:20:50 +01:00
guillep2k b74d30ae27
Prevent support libraries from compiling into Gitea (#10964)
* Prevent support libraries from compiling into Gitea

* Fix tag position

* Fix golangci-lint errors

* Refactor to make it work

Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
2020-04-05 11:35:02 +08:00
silverwind 6cf71ee0e8
Fix scrollbar issues in dropdowns (#10897)
* Fix scrollbar issues in dropdowns

Fixes: https://github.com/go-gitea/gitea/pull/10835

* remove wrapping

* grammar

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-04 18:29:15 -03:00
mrsdizzie a0cc4b3d08
Adjust label padding (#10957)
* Adjust label padding

* fix less complaint

* Make top/bottom padding a bit smaller to create better label look
2020-04-04 14:39:57 -05:00
Vasil Mikhalenya 240258a3e5
Avoiding directory execution on hook (#10954) (#10955)
* test -x is not enough https://stackoverflow.com/a/39489087
2020-04-04 11:29:58 -05:00
mrsdizzie 2a06d3a590
Enable GO111MODULE=on globally in Makefile (#10939)
Now that our minimum required go version is 1.12 we can remove code that disables GO111MODULE globally and turn it on, so each command doesn't need it set specifically.

Also fixes a small bug with make pr that didn't work because GO111MODULE=on wasn't set

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-04 19:41:00 +08:00
Lunny Xiao b264c30394
Move gocovmerge as vendor (#10947)
* Move gocovmerge as vendor

* Update Makefile

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-04 11:45:26 +03:00
赵智超 14c97c0501
Add titles and improve messages on sidebar menus (#10872)
* ui: add more message on sidebar menus

* add title on the menus
* show some message instead of hide choose bar when have nothing to choose
* add simply filter for each menus
* do same changes in mew_form.tmpl
* remove some unusefull comments in mew_form.tmpl

Signed-off-by: a1012112796 <1012112796@qq.com>

* do review suggestions

* add filter message  on sidebar filter
* change IsIssueWriter to HasIssuesOrPullsWritePermission

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-04 02:39:48 -03:00
Lunny Xiao 4f63f283c4
Rename scripts to build and add revive command as a new build tool command (#10942)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-04-03 22:29:12 +03:00
techknowlogick 4af7c47b38
Update docs to 1.11.4 (#10941) 2020-04-03 13:08:40 -04:00
zeripath 97eb37e823
Fix rebase conflict detection in git 2.26 (#10929)
* Fix rebase conflict detection in git 2.26

Git changed the technique used in rebase from
simple apply-patches to use merge. This breaks
our conflict detection code.

Signed-off-by: Andrew Thornton <art27@cantab.net>

* As per @techknowlogick reduce copying

Signed-off-by: Andrew Thornton <art27@cantab.net>
2020-04-03 19:00:41 +03:00
zeripath 57cca44c5e
Generate Diff and Patch direct from Pull head (#10936)
* Generate Diff and Patch direct from Pull head

Fix #10932
Also fix "Empty Diff/Patch File when pull is merged"

Closes #10934

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Add tests to ensure that diff does not change

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Ensure diffs and pulls pages work if head branch is deleted too

Signed-off-by: Andrew Thornton <art27@cantab.net>
2020-04-03 21:21:41 +08:00
赵智超 f685edf510
Change review status icons on PR view style to Github style (#10737)
* change the icon of ApproveReview pr from "eye" to "check" like github
* change the icon of RejectReview pr from "x" to "request-change" like github
* add "-" after "{{" which need to be one line (TODO: may be not change all)

Signed-off-by: a1012112796 <1012112796@qq.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-03 02:12:42 -03:00
j.yao.SUSE 3723b0647f
[UI] language status icon size (#10749)
* language status icon size

change the repository language status icon size

* Update _base.less

* fix: eslint rule  length-zero-no-unit

* [ui] .color-icon change size ti 14px

* Update web_src/less/_base.less

* Update web_src/less/_base.less

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-04-02 14:18:35 +03:00
GiteaBot 6c27f3e4e5 [skip ci] Updated translations via Crowdin 2020-04-01 19:05:15 +00:00
6543 a291a0eddc
Prevent deadlock in pull_service.GetDiverging(pr) (#10905)
* Switch to use a temporary repository instead of adding remotes to the base gitea repository to prevent deadlocking the base gitea repository.
* Add documentation on how to use func **createTemporaryRepo**
2020-04-01 20:03:08 +01:00
6543 d501aec427
Changelog v1.11.4 (#10916) (#10917)
* output of changelog

* Apply suggestions from code review

* Update CHANGELOG.md

Co-authored-by: zeripath <art27@cantab.net>

Co-authored-by: zeripath <art27@cantab.net>
2020-04-01 12:59:05 -04:00
Bagas Sanjaya 51140a970f
[Docs] Database Preparation - Connection over TLS (#10889)
* Database Preparation - Connection over TLS

* Step 6 MySQL edit

- have been created [before -> earlier]
- recreate user, [and this time]

* Apply suggestions from @guillep2k

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* certificat[e] typo

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-04-01 12:30:25 -03:00
zeripath 408bc2c8b5
Only update merge_base in checker if not already merged (#10908)
Fix #10766

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-04-01 15:02:11 +03:00
GiteaBot fbb0880d37 [skip ci] Updated translations via Crowdin 2020-04-01 06:35:41 +00:00
silverwind 848502d04c
Exclude vendor dirs from git CRLF normalization (#10911)
* Exclude vendor dirs from git CRLF normalization

Should get rid of a few warnings like at the end of `lint-backend` like
https://drone.gitea.io/go-gitea/gitea/23117/1/4

* make vendor

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-01 09:33:49 +03:00
mrsdizzie 8d99ee2773
Add Organization Wide Labels (#10814)
* Add organization wide labels

Implement organization wide labels similar to organization wide
webhooks. This lets you create individual labels for organizations that can be used
for all repos under that organization (so being able to reuse the same
label across multiple repos).

This makes it possible for small organizations with many repos to use
labels effectively.

Fixes #7406

* Add migration

* remove comments

* fix tests

* Update options/locale/locale_en-US.ini

Removed unused translation string

* show org labels in issue search label filter

* Use more clear var name

* rename migration after merge from master

* comment typo

* update migration again after rebase with master

* check for orgID <=0 per guillep2k review

* fmt

* Apply suggestions from code review

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* remove unused code

* Make sure RepoID is 0 when searching orgID per code review

* more changes/code review requests

* More descriptive translation var per code review

* func description/delete comment when issue label deleted instead of hiding it

* remove comment

* only use issues in that repo when calculating number of open issues for org label on repo label page

* Add integration test for IssuesSearch API with labels

* remove unused function

* Update models/issue_label.go

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Use subquery in GetLabelIDsInReposByNames

* Fix tests to use correct orgID

* fix more tests

* IssuesSearch api now uses new BuildLabelNamesIssueIDsCondition. Add a few more tests as well

* update comment for clarity

* Revert previous code change now that we can use the new BuildLabelNamesIssueIDsCondition

* Don't sort repos by date in IssuesSearch API

After much debugging I've found a strange issue where in some cases MySQL will return a different result than other enigines if a query is sorted by a null collumn. For example with our integration test data where we don't set updated_unix in repository fixtures:

SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 45

Returns different results for MySQL than other engines. However, the similar query:

SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 30

Returns the same results.

This causes integration tests to fail on MySQL in certain cases but would never show up in a real installation. Since this API call always returns issues based on the optionally provided repo_priority_id or the issueID itself, there is no change to results by changing the repo sorting method used to get ids earlier in the function.

* linter is back!

* code review

* remove now unused option

* Fix newline at end of files

* more unused code

* update to master

* check for matching ids before query

* Update models/issue_label.go

Co-Authored-By: 6543 <6543@obermui.de>

* Update models/issue_label.go

* update comments

* Update routers/org/setting.go

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2020-04-01 01:14:46 -03:00
John Olheiser 36d9237e60
Add accordion to release list and compact non-latest (#10910)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-03-31 17:39:54 -05:00
zeripath 2c25e75dca
Various Merge Base fixes (#10786)
* Fix broken merge base migration v128 for merged PR

* Allow PRs with deleted base branches to still show diff

* as per @lunny

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-03-31 16:42:44 +03:00
Lunny Xiao 73cf0e2614
Fix milestones too many SQL variables bug (#10880)
* Fix milestones too many SQL variables bug

* Fix test

* Don't display repositories with no milestone and fix tests

* Remove unused code and add some comments
2020-03-31 10:47:00 +03:00