Commit Graph
1932 Commits
Author SHA1 Message Date
Gary KimandLauris BH f1c414882c Add Ability for User to Customize Email Notification Frequency (#7813)
* Add Backend Logic for Toggling Email Notification

This commit adds the backend logic for
allowing users to enable or disable email
notifications. The implementation ensures
that only issue notification emails get disabled
and important emails are still sent regardless
of the setting.

The UI to toggle this setting has not yet been
implemented.

* Add UI and complete user email notification enable

This commit completes the functionality to allow
users to disable their own email notifications.

Signed-off-by: Gary Kim <[email protected]>

* Add Third Option for Only Email on Mention

Signed-off-by: Gary Kim <[email protected]>

* Readd NOT NULL to new preference string

Signed-off-by: Gary Kim <[email protected]>

* Add Tests and Rewrite Comment

Signed-off-by: Gary Kim <[email protected]>

* Allow admin to set default email frequency

Signed-off-by: Gary Kim <[email protected]>

* Add new config option to docs

Signed-off-by: Gary Kim <[email protected]>

* Fix a few mistakes

Signed-off-by: Gary Kim <[email protected]>

* Only update required columns

Signed-off-by: Gary Kim <[email protected]>

* Simplify an error check

Signed-off-by: Gary Kim <[email protected]>

* Make email_notification_preference column in DB be VARCHAR(20)

Signed-off-by: Gary Kim <[email protected]>

* Handle errors

Signed-off-by: Gary Kim <[email protected]>

* Update models/migrations/v93.go

Co-Authored-By: Lauris BH <[email protected]>
2019-08-29 17:05:42 +03:00
Richard Mahnandtechknowlogick 3302066f69 Fixes #7945 - makes sure we are only getting tag refs (#7990) 2019-08-26 23:11:24 -04:00
Antoine GIRARDandGitHub 954fe0e4e0 swagger/fix: []string are not enum by swagger definition (#7916)
* []string are not enum by swagger definition

* apply suggestion of @guillep2k

* re-generate swagger file
2019-08-26 20:13:10 +02:00
Mike SchwörerandAntoine GIRARD 042089fbaf API method to list all commits of a repository (#6408)
* Added API endpoint ListAllCommits (/repos/{owner}/{repo}/git/commits)

Signed-off-by: Mike Schwörer <[email protected]>

* Fixed failing drone build

Signed-off-by: Mike Schwörer <[email protected]>

* Implemented requested changes (PR reviews)

Signed-off-by: Mike Schwörer <[email protected]>

* gofmt

Signed-off-by: Mike Schwörer <[email protected]>

* Changed api route from "/repos/{owner}/{repo}/git/commits" to "/repos/{owner}/{repo}/commits"

* Removed unnecessary line

* better error message when git repo is empty

* make generate-swagger

* fixed removed return

* Update routers/api/v1/repo/commits.go

Co-Authored-By: Lauris BH <[email protected]>

* Update routers/api/v1/repo/commits.go

Co-Authored-By: Lauris BH <[email protected]>

* go fmt

* Refactored common code into ToCommit()

* made toCommit not exported

* added check for userCache == nil
2019-08-26 16:09:10 +02:00
David SvantessonandLauris BH c9546d4cdd Include description in repository search. (#7942)
* Add description in repository search.

Signed-off-by: David Svantesson <[email protected]>

* Refactor SearchRepositoryByName with a general function SearchRepository

Signed-off-by: David Svantesson <[email protected]>

* Allow to specify if description shall be included in API repo search.

Signed-off-by: David Svantesson <[email protected]>

* Add new app.ini setting for whether to search within repo description.

Signed-off-by: David Svantesson <[email protected]>

* Search keyword in description (if setting enabled) on:
 - Explore page
 - Organization profile page
 - User profile page
 - Admin repo page

Do not search keyword in description on:
 - Any non-keyword search (not relevant)
 - Incremental search (uses API)

Signed-off-by: David Svantesson <[email protected]>

* Put parameters related to keyword directly after it

Signed-off-by: David Svantesson <[email protected]>

* Add test cases for including (and not including) repository description in search.

Signed-off-by: David Svantesson <[email protected]>

* Rename test function from TestSearchRepositoryByName to TestSearchRepository.

Signed-off-by: David Svantesson <[email protected]>

* Make setting SEARCH_REPO_DESCRIPTION default to true

Signed-off-by: David Svantesson <[email protected]>
2019-08-25 20:06:36 +03:00
David SvantessonandLauris BH 8c24bb9e43 Abort syncrhonization from LDAP source if there is some error. (#7960)
Signed-off-by: David Svantesson <[email protected]>
2019-08-24 21:53:37 +03:00
guillep2kandLauris BH e3115cc019 Add support for DEFAULT_ORG_MEMBER_VISIBLE (#7669)
* Add support for DEFAULT_ORG_MEMBER_VISIBLE

* Correct formatting

* Improved description in cheat sheet.

* Add test for DefaultOrgMemberVisible

* Remove dead code
2019-08-24 15:28:59 +03:00
Lunny XiaoandAntoine GIRARD f83db078f0 Move database settings from models to setting (#7806)
* move database settings from models to setting

* update docs

* fix checkout pr

* fix tests

* fix lint

* remove unsupported tidb options

* correct wrong variable name

* remove tidb totally
2019-08-24 11:24:45 +02:00
David SvantessonandAntoine GIRARD ce45a8c257 Allow token as authorization for accessing attachments (#7909)
* Allow token as authorization for accessing attachments

Signed-off-by: David Svantesson <[email protected]>

* Only allow token authentication for attachments if it is a download (GET)
2019-08-24 02:33:32 +02:00
Tamal Sahaandtechknowlogick 171b359877 Use gitea forked macaron (#7933)
Signed-off-by: Tamal Saha <[email protected]>
2019-08-23 12:40:29 -04:00
Lunny XiaoandGitHub 09ca391230 Add file status on API (#7671)
* add file status on API

* fix tests

* fix tests

* fix tests
2019-08-21 13:16:22 +08:00
Lunny Xiaoandzeripath ed58919bfc fix bug when migrating a private repository (#7917) 2019-08-20 21:21:07 +01:00
Lunny XiaoandLauris BH 2d0b90c967 Fix upload file type check (#7890)
* fix upload file type check

* make the function simple and added tests

* Update comment as per @silverwind
2019-08-17 13:10:17 +03:00
zeripathandGitHub bee1227b2f Extract the username and password from the mirror url (#7651)
* Explode out mirror username and password

* Update models/repo_mirror.go

* Just roundtrip the password

* remove unused declaration

* Update templates/repo/settings/options.tmpl
2019-08-16 22:56:57 +01:00
NorwinandLauris BH 867f46f78e Detect delimiter in CSV rendering (#7869)
* detect csv delimiter in csv rendering

fixes #7868

* make linter happy

* fix failing testcase & use ints where possible

* expose markup type to template

previously all markup had the .markdown class, which is incorrect,
as it applies markdown CSS & JS logic to CSV rendering

* fix build (missing `make css`)

* ignore quoted csv content for delimiter scoring

also fix html generation
2019-08-16 01:09:50 +03:00
guillep2kandLunny Xiao 5661773018 Remove unique filter from repo indexer analyzer. (#7878)
* Remove unique filter from repo indexer analyzer.

* Bump repoIndexerLatestVersion to 4

* Corrrect fmt

* make vendor to remove unique dependency
2019-08-15 23:38:55 +08:00
Lunny XiaoandGitHub 85202d4784 Display ui time with customize time location (#7792)
* display ui time with customize time location

* fix lint

* rename UILocation to DefaultUILocation

* move time related functions to modules/timeutil

* fix tests

* fix tests

* fix build

* fix swagger
2019-08-15 22:46:21 +08:00
guillep2kandLunny Xiao 5a44be627c Convert files to utf-8 for indexing (#7814)
* Convert files to utf-8 for indexing

* Move utf8 functions to modules/base

* Bump repoIndexerLatestVersion to 3

* Add tests for base/encoding.go

* Changes to pass gosimple

* Move UTF8 funcs into new modules/charset package
2019-08-15 20:07:28 +08:00
Lunny XiaoandGitHub c021890930 move CreateReview to moduels/pull (#7841) 2019-08-14 23:32:19 +08:00
zeripathandLauris BH def84840db Attempt to fix hook problem (#7854) 2019-08-14 12:25:05 +03:00
Gary KimandLunny Xiao 7eed11e5e9 Check commit message hashes before making links (#7713)
* Check commit message hashes before making links

Previously, when formatting commit messages, anything
that looked like SHA1 hashes was turned into a link
using regex. This meant that certain phrases or numbers
such as `777777` or `deadbeef` could be recognized as a commit
even if the repository has no commit with those hashes.

This change will make it so that anything that looks
like a SHA1 hash using regex will then also be checked
to ensure that there is a commit in the repository
with that hash before making a link.

Signed-off-by: Gary Kim <[email protected]>

* Use gogit to check if commit exists

This commit modifies the commit hash check
in the render for commit messages to use
gogit for better performance.

Signed-off-by: Gary Kim <[email protected]>

* Make code cleaner

Signed-off-by: Gary Kim <[email protected]>

* Use rev-parse to check if commit exists

Signed-off-by: Gary Kim <[email protected]>

* Add and modify tests for checking hashes in html link rendering

Signed-off-by: Gary Kim <[email protected]>

* Return error in sha1CurrentPatternProcessor

Co-Authored-By: mrsdizzie <[email protected]>

* Import Gitea log module

Signed-off-by: Gary Kim <[email protected]>

* Revert "Return error in sha1CurrentPatternProcessor"

This reverts commit 28f561cac4.

Signed-off-by: Gary Kim <[email protected]>

* Add debug logging to sha1CurrentPatternProcessor

This will log errors by the git command run in
sha1CurrentPatternProcessor if the error is one
that was unexpected.

Signed-off-by: Gary Kim <[email protected]>
2019-08-14 16:04:55 +08:00
Antoine GIRARDandLunny Xiao 46d6b92ad0 Import topics during migration (#7851)
* add GetTopics interface

* CreateTopics

* remove un-needed comment
2019-08-14 14:16:12 +08:00
Mura LiandLauris BH 602155df7b Do not fetch all refs (#7797)
Which would unnecessarily slow down the pull compare operation.
2019-08-13 11:30:44 +03:00
WGHandLunny Xiao 98fd085039 Fix lax comparison in validation tests (#7815)
If you add t.Logf("%+v %+v", actual, testCase.expectedErrors) to
the test code, you'll notice that only Errors' Messages are being
compared:

    --- PASS: Test_ValidURLValidation/Invalid_schema (0.00s)
    binding_test.go:43: [Url] [Url]

FieldNames and Classification are ignored in comparison.

Moreover, an Errors slice with a single Error with empty message
is formatted as '[]' (the same as empty slice), which is also
error-prone. I discovered this when working on #7791 when one test which
was not supposed to pass did pass. https://play.golang.org/p/qC4wVLrm4NG

This commit changes the test to do the comparison properly.
2019-08-12 10:17:25 +08:00
Antoine GIRARDandLauris BH e9bb75d8d1 Fix duplicate call of webhook (#7821) 2019-08-11 23:31:18 +03:00
guillep2kandLauris BH 2594693a46 Remove camel case tokenization from repo indexer (#7733)
* Make repository indexer tokenize by camel case selectable

* Revert "Make repository indexer tokenize by camel case selectable"

This reverts commit a8d4e40af5.

* Remove app.ini setting, permanently remove camel case tokenizer

* Increase repoIndexerLatestVersion to force indexes to be rebuilt

* Changes introduced by the commmand make vendor
2019-08-06 07:38:16 +03:00
zeripathandGitHub 7ad67109d7 Be more strict with git arguments (#7715)
* Be more strict with git arguments
* fix-up commit test
* use bindings for branch name
2019-08-05 21:39:39 +01:00
silverwindandLunny Xiao 1d8915ad5d Add a lot of extension to language mappings for syntax highlights (#7741)
Data partially based on [CodeMirror's meta.js](https://github.com/codemirror/CodeMirror/blob/master/mode/meta.js).

Fixes: https://github.com/go-gitea/gitea/issues/6057
2019-08-05 23:48:31 +08:00
FlorianBenandLunny Xiao 0e887af2d1 Fix specific highlighting (CMakeLists.txt ...) (#7686)
* Fix specific highlighting.

* Highlighting CMakeLists.txt:
remove case sensitive checks.
use lowercase checks instead.
2019-08-04 16:11:27 +08:00
guillep2kandLunny Xiao 3566d2c860 Include "executable" files in the index, as they are not necessarily binary (#7718) 2019-08-02 23:14:50 +08:00
Lunny Xiaoandtechknowlogick e503794371 remove unnecessary fmt on generate bindata (#7706) 2019-08-01 13:34:46 -04:00
zeripathandtechknowlogick a4b7a4f2f8 Correct wrong datetime format for git (#7689) 2019-07-31 15:19:47 -04:00
Lunny XiaoandGitHub e7d4895732 Move commit repo action from models to repofiles package (#7645)
* move commit repo action from models to repofiles package

* fix unit tests
2019-07-30 09:59:10 +08:00
Lunny Xiaoandzeripath a94ae7acb0 fix bug on migrating milestone from github (#7665) 2019-07-29 16:41:22 +01:00
Lunny Xiaoandzeripath 6782a704ef Fix bug create/edit wiki pages when code master branch protected (#7580)
* fix bug create/edit wiki pages when code master branch protected

* improve FullPushingEnvironment function
2019-07-25 22:50:20 +01:00
zeripathandGitHub 6485962dd5 Fix panic on push at #7611 (#7615)
* Fix panic in #7611

Use pr.IssueID instead of pr.Issue.ID as Issue may not be loaded and is unnecessary

* Only fetch the head branch from the remote
2019-07-25 19:05:51 +01:00
Lunny XiaoandGitHub 2c5c458dd7 Move models.PushUpdate to repofiles.PushUpdate (#7485)
* move models.PushUpdate to repofiles.PushUpdate

* remove duplicated code to load repo
2019-07-24 15:13:26 +08:00
Christian Muehlhaeuserandzeripath 5e4e7d3df0 Added missing error checks in tests (#7554)
Whenever we assign a value to err, check for it being nil.
2019-07-23 20:28:43 +01:00
Christian Muehlhaeuserandzeripath 54d96c79b5 Removed unnecessary conversions (#7557)
No need to convert to the same type.
2019-07-23 19:50:39 +01:00
silverwindandLauris BH fe7689a6b2 Fix empty commits now showing in repo overview (#7521)
* Fix empty commits now showing in repo overview

* add test

* make fmt
2019-07-22 15:03:15 +03:00
Christian MuehlhaeuserandLauris BH 9a965035f0 Un-lambda base.FileSize (#7556)
No need to wrap this.
2019-07-22 11:58:26 +03:00
Lunny Xiaoandtechknowlogick 8ad64574ee Fix markdown invoke sequence (#7513) 2019-07-18 16:23:27 -04:00
Lunny XiaoandGitHub 8ea60e7e61 remove duplicated webhook trigger (#7511) 2019-07-18 16:54:55 +08:00
Lunny XiaoandGitHub ce087c58ef Remove settting dependency on modules/session (#7237)
* remove settting dependency on modules/session

* fix fmt

* fix tests

* fix lint
2019-07-17 09:04:37 +08:00
Lunny Xiaoandtechknowlogick d2958d9f46 Move status table to cron package (#7370) 2019-07-15 20:13:03 -04:00
Lunny XiaoandGitHub 2739a0be98 only create opened pull request when migrating from github (#7463) 2019-07-14 17:16:15 +08:00
Tamal Sahaandtechknowlogick 2102f9d92d Support setting cookie domain (#6288)
Signed-off-by: Tamal Saha <[email protected]>
2019-07-12 09:57:31 -04:00
CherrgandLunny Xiao a7b1ba0e3d wiki history improvements (#7391)
* add history comments to detect page delete

Signed-off-by: Michael Gnehr <[email protected]>

* fix too much history entries
- caused by --follow flag
  - if files with same contents exists

Signed-off-by: Michael Gnehr <[email protected]>

* style imprevements wiki
- history - wrap long author names

Signed-off-by: Michael Gnehr <[email protected]>
2019-07-11 22:45:10 +08:00
Lunny XiaoandLauris BH 427a161c67 Fix migration tests since #7 fixed (#7375)
* fix migration tests since #7 fixed

* fix test time
2019-07-08 13:10:56 +03:00
mrsdizzieandLunny Xiao 1f1ecda541 Display original author and URL information when showing migrated issues/comments (#7352)
* Store original author info for migrated issues and comments

Keep original author name for displaying in Gitea interface and also
store original author user ID for potential future use in linking
accounts from old location.

* Add original_url for repo

Store the original URL for a migrated repo

Clean up migrations/tests

* fix migration

* fix golangci-lint

* make 'make revive' happy also

* Modify templates to use OriginalAuthor if set

Use the original author name in templates if it is set rather than the
user who migrated/currently owns the issues

* formatting fixes

* make generate-swagger

* Use default avatar for imported comments

* Remove no longer used IgnoreIssueAuthor option

* Add OriginalAuthorID to swagger also
2019-07-08 10:14:12 +08:00