Commit Graph
660 Commits
Author SHA1 Message Date
Lauris BH 20c513be6e Show download count info in release list (#10124)
* Show download count info in release list

* Use go-humanize
2020-02-03 21:50:37 +02:00
zeripath b4914249ee Update aria-fixed semantic-dropdown to fomantic master (#10096)
Co-authored-by: techknowlogick <[email protected]>
2020-02-02 17:28:00 -05:00
zeripath f8f6adc2a6 Add button to revert SimpleMDE to plain textarea (#10099) 2020-02-01 17:06:57 +00:00
silverwind 35ada598cc move jquery.are-you-sure to npm/webpack (#10063) 2020-01-29 21:16:55 +00:00
silverwind 7c84dbca4f fix gitgraph commit hashes in dark theme (#10046)
because the CSS was lazy-loaded the rules in arc-green did not win.
included the css file in the main bundle to fix. the black dots can not
be fixed via CSS because they are drawn in a `<canvas>` element
unfortunately.
2020-01-28 23:22:39 +00:00
silverwind b9690d7c0b move highlight.js to npm/webpack (#10011)
- introduced window.config to help with js-based lazy-loading
- adjusted webpack chunk naming to avoid 'vendors~name.js' that webpack
  defaults to for vendor chunks.
- added theme class to html and prefixed all selectors. this is
  neccesary so that the theme styles win over the lazy-loaded ones.

Co-authored-by: zeripath <[email protected]>
2020-01-28 23:57:20 +02:00
silverwind 1019913eab move CSS build to webpack (#9983)
- added new 'make webpack' target
- deprecated 'make js' and 'make css'
- extend webpack config to load the less files
- updated docs

I had to rename the source file of `arc-green.less` to avoid generating
a useless JS entrypoint via webpack-fix-style-only-entries which would
not work with different source/destination filenames. I hear that there
should be cleaner solutions possible once we upgrade to Webpack 5.

Co-authored-by: zeripath <[email protected]>
2020-01-28 07:30:39 +00:00
silverwind fd094eea95 fix commit view JS features, reimplement folding (#9968)
* fix commit view JS features, reimplement folding

File content folding was not working so I reimplemented it in a saner
way. Then I noticed the issue was actually because of missing JS
libraries (seen on the console of every commit with error
'SimpleMDE is not defined').

Fixed the libraries. I think the reimplementation is worth to keep.

* add .closest polyfill

Co-authored-by: Lunny Xiao <[email protected]>
2020-01-26 08:17:25 +00:00
Lauris BH 59510d6227 Change font to Roboto to support more charsets (#9803) 2020-01-25 23:47:42 +02:00
silverwind 5b17bb8f3d add css extraction and minification to webpack (#9944)
This changes the CSS output of webpack to output to the public/css
directory instead of inling CSS in JS. This enables CSS minification and
autoprefixer based on browserslist which would otherwise not be
possible.

The result of this change is two new output files currently:

- public/css/swagger.css
- public/css/gitgraph.css

Co-authored-by: techknowlogick <[email protected]>
2020-01-25 16:41:34 +08:00
silverwind 2982afe6b4 move jquery and jquery-migrate to npm/webpack (#9813)
Currently, this needs to be its own chunk because fomantic depends
on jQuery being present. The next step is to move fomantic to webpack
too after which we can combine the index,fomantic and jquery files into
one.

jquery-migrate is still neccessary because our ancient version of Dropzone
seems to break without it. I imagine it can be removed after a Dropzone
upgrade.
2020-01-21 19:32:33 +02:00
Lunny Xiao 5cf241b312 Use npm to manage fomantic and only build needed components (#9561)
* Use npm to manage fomantic

* Only build needed semantic components

* Fix make

* Don't import fonts from google sites since we have loaded

* [misc] devendor fomantic-ui and rebuild upon src or config changes only

Signed-off-by: Jakob Ackermann <[email protected]>

* Change sort alphabetically of semantic components

* Fix trailing slash

* fix makefile

* Remove dependency to gulp from package.json

* Fix something

* Simplife the makefile

* add missed fomantic compnent

Co-authored-by: Jakob Ackermann <[email protected]>
2020-01-21 13:17:58 +08:00
Lauris BH 81cfe243f9 Add top author stats to activity page (#9615) 2020-01-20 12:07:30 +02:00
John Olheiser 7d7ab1eeae Issue/PR Context Popups (#9822)
* Add data-index attribute to issue anchors

Signed-off-by: jolheiser <[email protected]>

* Init JS

Signed-off-by: jolheiser <[email protected]>

* Add required data to anchor

Signed-off-by: jolheiser <[email protected]>

* Finish popup

Signed-off-by: jolheiser <[email protected]>

* Revert changes to html.go

Signed-off-by: jolheiser <[email protected]>

* Better octicon contexts

Signed-off-by: jolheiser <[email protected]>

* Split out popup function for re-use

Signed-off-by: jolheiser <[email protected]>

* Style changes, test fixes, and cross-reference support

Signed-off-by: jolheiser <[email protected]>

* Prefer em to px

Signed-off-by: jolheiser <[email protected]>

* Move label margin to base CSS

Signed-off-by: jolheiser <[email protected]>

* Move JS to separate file.

Signed-off-by: jolheiser <[email protected]>

* Move JS to features and fix module

Signed-off-by: jolheiser <[email protected]>

* Remove query-string and hash

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

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: Antoine GIRARD <[email protected]>
Co-authored-by: silverwind <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: zeripath <[email protected]>
2020-01-19 23:39:21 -05:00
Lunny Xiao f540d0ac87 Fix issues/pulls dependencies problems (#9842)
* Fix issues/pulls dependencies problems

* fix swagger and api param name

* fix js
2020-01-19 14:43:38 +08:00
6543 36943e56d6 Add "Update Branch" button to Pull Requests (#9784)
* add Divergence

* add Update Button

* first working version

* re-use code

* split raw merge commands and db-change functions (notify, cache, ...)

* use rawMerge (remove redundant code)

* own function to get Diverging of PRs

* use FlashError

* correct Error Msg

* hook is triggerd ... so remove comment

* add "branch2" to "user2/repo1" because it unit-test "TestPullView_ReviewerMissed" use it but dont exist jet :/

* move GetPerm to IsUserAllowedToUpdate

* add Flash Success MSG

* imprufe code
- remove useless js chage

* fix-lint

* TEST: add PullRequest ID:5
Repo: user2/repo1
Base: branch1
Head: pr-to-update

* correct comments

* make PR5 outdated

* fix Tests

* WIP: add pull update test

* update revs

* update locales

* working TEST

* update UI

* misspell

* change style

* add 1s delay so rev exist

* move row up (before merge row)

* fix lint nit

* UI remove divider

* Update style

* nits

* do it right

* introduce IsSameRepo

* remove useless check

Co-authored-by: Lauris BH <[email protected]>
2020-01-17 08:03:40 +02:00
zeripath 66ee9b87f9 Add require signed commit for protected branch (#9708)
* Add require signed commit for protected branch

* Fix fmt

* Make editor show if they will be signed

* bugfix

* Add basic merge check and better information for CRUD

* linting comment

* Add descriptors to merge signing

* Slight refactor

* Slight improvement to appearances

* Handle Merge API

* manage CRUD API

* Move error to error.go

* Remove fix to delete.go

* prep for merge

* need to tolerate \r\n in message

* check protected branch before trying to load it

* Apply suggestions from code review

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

* fix commit-reader

Co-authored-by: guillep2k <[email protected]>
2020-01-15 09:32:57 +01:00
John Olheiser d89022c202 Fix SimpleMDE quote reply (#9757)
Signed-off-by: jolheiser <[email protected]>

Co-authored-by: zeripath <[email protected]>
2020-01-14 21:47:38 +01:00
silverwind f00961abe7 move swagger-ui to webpack/npm (#9714)
Created a second webpack output file for swagger-ui which is loaded on
the /api/swagger route. One notable difference is the absence of the
swagger favicon that was previously used which is now the gitea icon. I
see no easy way to restore that favicon, so I decided to not keep it.
2020-01-14 13:02:08 -05:00
silverwind 86464de0c1 silence fomantic error regarding tabs (#9713)
Fomantic expects all tabs to have a target element with content as
defined by the data-tab attribute. All our usage of the tab module seems
to use <a> element tabs that link to new pages so these content elements
are never present and fomantic complains about that in the console with
an "Activated tab cannot be found" error. This silences that error.
2020-01-12 03:57:32 +01:00
silverwind b3722114ce eliminate horizontal scroll caused by footer (#9669) 2020-01-09 19:33:39 +00:00
zeripath 2a1cf5bae9 Add some padding to the shadowed comment box (#9612)
* Add some padding to the shadowed comment box
* prevent the padding affecting the other comments
2020-01-05 19:25:27 +00:00
John Olheiser 4f54a4628a !important makes me sad (#9607)
Signed-off-by: jolheiser <[email protected]>
2020-01-05 06:56:06 +02:00
John Olheiser 08424648ae Fix create bugs (#9606)
Signed-off-by: jolheiser <[email protected]>
2020-01-04 21:39:14 -05:00
John Olheiser b2b10858c6 Don't auto-init SimpleMDE for review textarea (#9574)
Signed-off-by: jolheiser <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
2020-01-02 04:02:11 +01:00
John Olheiser a864d61ee6 Add box-shadow to blue buttons in normal theme (#9573)
Signed-off-by: jolheiser <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
2020-01-01 00:06:15 -05:00
zeripath c2d854cfd2 In SimpleMDE check if trigger exists before call (#9545) 2019-12-30 17:11:50 +00:00
Lunny Xiao c0f8795462 Upgrade lato fonts to v16. (#9498)
* Upgrade lato fonts to v16

* Upgrade lato fonts to v16

* fix bug
2019-12-25 23:11:39 -05:00
John Olheiser e6ceb6880a Prefix all user-generated IDs in markup (#9477)
* Prefix all user-generated IDs in markup
* Add user-content- to IDs in unit-tests
* fixup markdown_test.go
* update the hrefs for the wiki test
* Add blackfriday extension regex

Signed-off-by: jolheiser <[email protected]>
2019-12-23 22:38:50 +00:00
Alexey 〒erentyev 4147cc91ed Fix background reactions in the arc-green theme (#9421)
* Fixed arc-green theme reactions background

Signed-off-by: Alexey Terentyev <[email protected]>

* Added MD5 AppVer

Signed-off-by: Alexey Terentyev <[email protected]>
2019-12-18 22:35:03 -05:00
techknowlogick 590d56dbb3 switch to fomantic-ui (#9374) 2019-12-17 16:34:11 -05:00
Alexey 〒erentyev 2b7e4cc1bd Fixed show repositories filter (#9234) (#9379)
Signed-off-by: Alexey Terentyev <[email protected]>
2019-12-17 19:03:35 +08:00
Benno 121977c36f Add SimpleMDE and Fix Image Paste for Issue/Comment Editor (#9197)
* update #9132 and #8834 - add SimpleMDE for issue and fix image paste for comment editor

* attache tribute to simplemde

* update #9197 force simplemde file input event when backspace press
2019-12-16 23:56:35 +08:00
Mario Lubenka 61db834904 Change target branch for pull request (#6488)
* Adds functionality to change target branch of created pull requests

Signed-off-by: Mario Lubenka <[email protected]>

* Use const instead of var in JavaScript additions

Signed-off-by: Mario Lubenka <[email protected]>

* Check if branches are equal and if PR already exists before changing target branch

Signed-off-by: Mario Lubenka <[email protected]>

* Make sure to check all commits

Signed-off-by: Mario Lubenka <[email protected]>

* Print error messages for user as error flash message

Signed-off-by: Mario Lubenka <[email protected]>

* Disallow changing target branch of closed or merged pull requests

Signed-off-by: Mario Lubenka <[email protected]>

* Resolve conflicts after merge of upstream/master

Signed-off-by: Mario Lubenka <[email protected]>

* Change order of branch select fields

Signed-off-by: Mario Lubenka <[email protected]>

* Removes duplicate check

Signed-off-by: Mario Lubenka <[email protected]>

* Use ctx.Tr for translations

Signed-off-by: Mario Lubenka <[email protected]>

* Recompile JS

Signed-off-by: Mario Lubenka <[email protected]>

* Use correct translation namespace

Signed-off-by: Mario Lubenka <[email protected]>

* Remove redundant if condition

Signed-off-by: Mario Lubenka <[email protected]>

* Moves most change branch logic into pull service

Signed-off-by: Mario Lubenka <[email protected]>

* Completes comment

Signed-off-by: Mario Lubenka <[email protected]>

* Add Ref to ChangesPayload for logging changed target branches
instead of creating a new struct

Signed-off-by: Mario Lubenka <[email protected]>

* Revert changes to go.mod

Signed-off-by: Mario Lubenka <[email protected]>

* Directly use createComment method

Signed-off-by: Mario Lubenka <[email protected]>

* Return 404 if pull request is not found. Move written check up

Signed-off-by: Mario Lubenka <[email protected]>

* Remove variable declaration

Signed-off-by: Mario Lubenka <[email protected]>

* Return client errors on change pull request target errors

Signed-off-by: Mario Lubenka <[email protected]>

* Return error in commit.HasPreviousCommit

Signed-off-by: Mario Lubenka <[email protected]>

* Adds blank line

Signed-off-by: Mario Lubenka <[email protected]>

* Test patch before persisting new target branch

Signed-off-by: Mario Lubenka <[email protected]>

* Update patch before testing (not working)

Signed-off-by: Mario Lubenka <[email protected]>

* Removes patch calls when changeing pull request target

Signed-off-by: Mario Lubenka <[email protected]>

* Removes unneeded check for base name

Signed-off-by: Mario Lubenka <[email protected]>

* Moves ChangeTargetBranch completely to pull service. Update patch status.

Signed-off-by: Mario Lubenka <[email protected]>

* Set webhook mode after errors were validated

Signed-off-by: Mario Lubenka <[email protected]>

* Update PR in one transaction

Signed-off-by: Mario Lubenka <[email protected]>

* Move logic for check if head is equal with branch to pull model

Signed-off-by: Mario Lubenka <[email protected]>

* Adds missing comment and simplify return

Signed-off-by: Mario Lubenka <[email protected]>

* Adjust CreateComment method call

Signed-off-by: Mario Lubenka <[email protected]>
2019-12-16 14:20:25 +08:00
zeripath dc2fe9801f Make repository management section handle lfs locks (#8726)
* Make repository maangement section handle lfs locks

* Add check attribute handling and handle locking paths better

* More cleanly check-attributes

* handle error

* Check if file exists in default branch before linking to it.

* fixup

* Properly cleanPath

* Use cleanPath

* Sigh
2019-12-12 21:18:07 +08:00
Benno cecc31951c fix #9198 make diff detail sticky again (#9280) 2019-12-07 13:01:57 -05:00
silverwind d672206800 Update JS dependencies (#9255)
This is the result of `make npm-update`. I also fixed a minor linting
issue which came up with the eslint 6.7 update.
2019-12-06 14:41:25 +08:00
Alexey 〒erentyev e80fe201c0 Fixed topics margin (#9248)
Signed-off-by: Alexey Terentyev <[email protected]>
2019-12-03 23:10:40 -05:00
jaqra 8875586570 Change some label colors (#9051)
* Change label colors

* Override black basic label background for green theme on label list
2019-12-03 20:39:58 -05:00
David Svantesson bac4b78e09 Branch protection: Possibility to not use whitelist but allow anyone with write access (#9055)
* Possibility to not use whitelist but allow anyone with write access

* fix existing test

* rename migration function

* Try to give a better name for migration step

* Clear settings if higher level setting is not set

* Move official reviews to db instead of counting approvals each time

* migration

* fix

* fix migration

* fix migration

* Remove NOT NULL from EnableWhitelist as migration isn't possible

* Fix migration, reviews are connected to issues.

* Fix SQL query issues in GetReviewersByPullID.

* Simplify function GetReviewersByIssueID

* Handle reviewers that has been deleted

* Ensure reviews for test is in a well defined order

* Only clear and set official reviews when it is an approve or reject.
2019-12-03 20:08:56 -05:00
John Olheiser 51432ebb9c Fix context menu overflow & review tag margin (#9231)
* Fix context menu overflow

Signed-off-by: jolheiser <[email protected]>

* Add review tag CSS

Signed-off-by: jolheiser <[email protected]>
2019-12-03 01:03:30 +02:00
Alexey 〒erentyev 2fc3eb1d15 Fixed topic regex pattern and added search by topic links after save (#9219)
Signed-off-by: Alexey Terentyev <[email protected]>
2019-12-02 11:13:19 +02:00
jaqra 802aa6d5f3 Add comment highlight when target from url (#9047)
* Add comment highlight css

* Add js to remove highlight on click outside

* Improve refresh page on click outside

* Use location.hash property to remove target

* Handle click ONLY clicked outside of 'targetted comment' (not other comment)

* Remove unnecessary checks and simply code

* Combine hash and setState to remove target path
2019-11-25 11:50:46 +00:00
Benno bb2c0c3729 fix add comment button text align (#9140) 2019-11-24 01:07:15 +02:00
QuaSoft 7b4d2f7a2a Add single sign-on support via SSPI on Windows (#8463)
* Add single sign-on support via SSPI on Windows

* Ensure plugins implement interface

* Ensure plugins implement interface

* Move functions used only by the SSPI auth method to sspi_windows.go

* Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected

* Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links.

* Update documentation for the new 'SPNEGO with SSPI' login source

* Mention in documentation that ROOT_URL should contain the FQDN of the server

* Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing)

* Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources)

* Add option in SSPIConfig for removing of domains from logon names

* Update helper text for StripDomainNames option

* Make sure handleSignIn() is called after a new user object is created by SSPI auth method

* Remove default value from text of form field helper

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

* Remove default value from text of form field helper

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

* Remove default value from text of form field helper

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

* Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates

* Remove code duplication

* Log errors in ActiveLoginSources

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

* Revert suffix of randomly generated E-mails for Reverse proxy authentication

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

* Revert unneeded white-space change in template

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

* Add copyright comments at the top of new files

* Use loopback name for randomly generated emails

* Add locale tag for the SSPISeparatorReplacement field with proper casing

* Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields

* Update docs/content/doc/features/authentication.en-us.md

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

* Remove Priority() method and define the order in which SSO auth methods should be executed in one place

* Log authenticated username only if it's not empty

* Rephrase helper text for automatic creation of users

* Return error if more than one active SSPI auth source is found

* Change newUser() function to return error, letting caller log/handle the error

* Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed

* Refactor initialization of the list containing SSO auth methods

* Validate SSPI settings on POST

* Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page

* Make 'Default language' in SSPI config empty, unless changed by admin

* Show error if admin tries to add a second authentication source of type SSPI

* Simplify declaration of global variable

* Rebuild gitgraph.js on Linux

* Make sure config values containing only whitespace are not accepted
2019-11-23 01:33:31 +02:00
silverwind 7bc8c6b180 move semantic.dropdown.custom.js to webpack (#9064)
* move semantic.dropdown.custom.js to webpack

Also disabled a annoying linter rule which insisted that imports can not
contain a file extension.

Fixes: https://github.com/go-gitea/gitea/issues/8971

* reorganize web_src files and rebuild

* restart ci
2019-11-21 18:30:14 -05:00
guillep2k c57edb6c7b Add password requirement info on error (#9074)
* Add password requirement info on error

* Move BuildComplexityError to the password pkg

* Unexport complexity type

* Fix extra line

* Update modules/password/password.go

Co-Authored-By: Lauris BH <[email protected]>
2019-11-19 22:44:58 +00:00
John Olheiser eb0359cad4 Context menus for comments (#9043)
* Add quote replies

Signed-off-by: jolheiser <[email protected]>
2019-11-19 20:33:42 +02:00
Vedran ef513e1af3 Fix double scroll in branch dropdown (#9048)
* Fix double scroll in branch dropdown

* Revert of 425ae38aa9

* Changes in .less, generated new .css

* Revert unnecessary commented line
2019-11-18 09:25:24 +08:00
silverwind f8bd90ba60 enable lazy-loading of gitgraph.js (#9036)
- moved gitgraph.js to web_src and made it importable and es6-compatible
- created new webpack chunk for gitgraph
- enabled CSS loader in webpack
- enabled async/await syntax via regenerator-runtime
- added script to ensure webpack chunks are loaded correctly
- disable terser's comment extraction to prevent .LICENCE files

gitgraph.js has many issues:

1. it is incompatible with ES6 because of strict-mode violations
1. it does not export anything
1. it's css has weird styles like for `body`
1. it is not available on npm

I fixed points 1-3 in our version so it's now loadable in webpack. We should eventually consider alternatives.
2019-11-17 23:39:06 +02:00