aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js
Commit message (Collapse)AuthorAgeFilesLines
* Add "Allow edits from maintainer" feature (#18002)qwerty2872022-04-282-0/+35
| | | | | | | | | | | | | | | | | Adds a feature [like GitHub has](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) (step 7). If you create a new PR from a forked repo, you can select (and change later, but only if you are the PR creator/poster) the "Allow edits from maintainers" option. Then users with write access to the base branch get more permissions on this branch: * use the update pull request button * push directly from the command line (`git push`) * edit/delete/upload files via web UI * use related API endpoints You can't merge PRs to this branch with this enabled, you'll need "full" code write permissions. This feature has a pretty big impact on the permission system. I might forgot changing some things or didn't find security vulnerabilities. In this case, please leave a review or comment on this PR. Closes #17728 Co-authored-by: 6543 <6543@obermui.de>
* Improve dashboard's repo list performance (#18963)Gusted2022-04-261-20/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Improve dashboard's repo list performance - Avoid a lot of database lookups for all the repo's, by adding a undocumented "minimal" mode for this specific task, which returns the data that's only needed by this list which doesn't require any database lookups. - Makes fetching these list faster. - Less CPU overhead when a user visits home page. * Refactor javascript code + fix Fork icon - Use async in the function so we can use `await`. - Remove `archivedFilter` check for count, as it doesn't make sense to show the count of repos when you can't even see them(as they are filited away). * Add `count_only` * Remove uncessary code * Improve comment Co-authored-by: delvh <dev.lh@web.de> * Update web_src/js/components/DashboardRepoList.js Co-authored-by: delvh <dev.lh@web.de> * Update web_src/js/components/DashboardRepoList.js Co-authored-by: delvh <dev.lh@web.de> * By default apply minimal mode * Remove `minimal` paramater * Refactor count header * Simplify init Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Allow commit status popup on /pulls page (#19507)parnic2022-04-263-13/+20
| | | | | | | | | | | * Allow commit status popup on /pulls page The /pulls page doesn't contain a "repository" element, so the early-out here was preventing the commit status popup hook from working. However, the only thing the .repository element is being used for here is determining whether the popup should be on the right or on the left, so we don't actually need the element to exist for the hook to work. Pull request #19375 allows the statuses on /pulls pages to appear clickable, but this commit is required to make the popup actually work there. * Move commit statuses popup hook to dedicated func * Add missing import
* Add a new menu in file view to open blame view and fix blame view select ↵Lunny Xiao2022-04-261-4/+18
| | | | range bug (#19500)
* Fix two UI bugs: JS error in imagediff.js, 500 error in diff/compare.tmplwxiaoguang2022-04-261-4/+11
| | | Co-authored-by: 6543 <6543@obermui.de>
* Improve Stopwatch behavior (#18930)Gusted2022-04-251-0/+4
| | | | - Don't send empty stopwatch over and over again, only send once. - Stop interval to update stopwatch's timer when there is no more stopwatch.
* Never use /api/v1 from Gitea UI Pages (#19318)Lunny Xiao2022-04-0710-14/+14
| | | | | | | | | | | | | Reusing `/api/v1` from Gitea UI Pages have pros and cons. Pros: 1) Less code copy Cons: 1) API/v1 have to support shared session with page requests. 2) You need to consider for each other when you want to change something about api/v1 or page. This PR moves all dependencies to API/v1 from UI Pages. Partially replace #16052
* Skip frontend ROOT_URL check on installation page, remove unnecessary global ↵wxiaoguang2022-04-011-0/+3
| | | | | | var (#19291) Skip `checkAppUrl` message on installation page because the ROOT_URL is not determined yet Move global var `supportedDbTypeNames` into `install.Init` as a local var
* Show messages for users if the ROOT_URL is wrong, show JavaScript errors ↵wxiaoguang2022-03-304-9/+65
| | | | | | | | | | | | | | (#18971) * ROOT_URL issues: some users did wrong to there app.ini config, then: * The assets can not be loaded (AppSubUrl != "" and users try to access http://host:3000/) *The ROOT_URL is wrong, then many URLs in Gitea are broken. Now Gitea show enough information to users. * JavaScript error issues, there are many users affected by JavaScript errors, some are caused by frontend bugs, some are caused by broken customized templates. If these JS errors can be found at first time, then maintainers do not need to ask about how bug occurs again and again. * Some people like to modify the `head.tmpl`, so we separate the script part to `head_script.tmpl`, then it's much safer. * use specialized CSS class "js-global-error", end users still have a chance to hide error messages by customized CSS styles.
* Refactor repo clone button and repo clone links, fix JS error on empty repo ↵wxiaoguang2022-03-292-19/+49
| | | | | | | | | | | | | | | | | page (#19208) The last PR about clone buttons introduced an JS error when visiting an empty repo page: * https://github.com/go-gitea/gitea/pull/19028 * `Uncaught ReferenceError: isSSH is not defined`, because the variables are scoped and doesn't share between sub templates. This: 1. Simplify `templates/repo/clone_buttons.tmpl` and make code clear 2. Move most JS code into `initRepoCloneLink` 3. Remove unused `CloneLink.Git` 4. Remove `ctx.Data["DisableSSH"] / ctx.Data["ExposeAnonSSH"] / ctx.Data["DisableHTTP"]`, and only set them when is is needed (eg: deploy keys / ssh keys) 5. Introduce `Data["CloneButton*"]` to provide data for clone buttons and links 6. Introduce `Data["RepoCloneLink"]` for the repo clone link (not the wiki) 7. Remove most `ctx.Data["PageIsWiki"]` because it has been set in the `/wiki` middleware 8. Remove incorrect `quickstart` class in `migrating.tmpl`
* Feature: show issue assignee on project board (#15232)Roger Luo2022-03-091-0/+8
| | | | * Show assignees in project boards.
* Fix EasyMDE error when input Enter (#19004)wxiaoguang2022-03-061-2/+2
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix the editor height in review box (#19003)wxiaoguang2022-03-041-1/+2
| | | | | | | | | | | | | | | | Fix the height problem in https://github.com/go-gitea/gitea/pull/18862#issuecomment-1059329539 I have tested this fix. # Screenshots ### Min-height <img width="1138" alt="image" src="https://user-images.githubusercontent.com/2114189/156811831-93d4d31a-1b0a-4c4c-a7b4-fafc706133d6.png"> ### Max-height <img width="1126" alt="image" src="https://user-images.githubusercontent.com/2114189/156811889-10ae41de-c63b-45e7-9d89-21a1ed29e58b.png">
* Remove CodeMirror dependencies (#18911)silverwind2022-02-261-40/+3
| | | EasyMDE already loads all the modes and plugins it needs, so there is no reason for neither the webpack dependency nor the vendored copy
* Set max text height to prevent overflow (#18862)Kyle D2022-02-231-1/+1
| | | | | | | | | | | Sets a max height for review text boxes to prevent a very annoying bug where users cannot access the "submit" button. Before: ![image](https://user-images.githubusercontent.com/12700993/155253001-e1dab086-aaf3-4338-889d-6a861728274a.png) After: ![image](https://user-images.githubusercontent.com/12700993/155253144-5b9a3547-9582-412f-867f-41a45a14a0fe.png) Interestingly, I don't see this bug on Firefox.
* Fix behavior or checkbox submission. (#18851)Gusted2022-02-221-0/+2
|
* Replace deprecated String.prototype.substr() with String.prototype.slice() ↵CommanderRoot2022-02-186-11/+11
| | | | | | | | | (#18796) String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with the slice() method which works similarily but isn't deprecated. Signed-off-by: Tobias Speicher <rootcommander@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Various Mermaid improvements (#18776)silverwind2022-02-161-15/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Various Mermaid improvments - Render into iframe for improved security - Use built-in dark theme instead of color inversion - Remove flexbox attributes, resulting in more consistent size rendering - Update API usage and update to latest version * restart ci * misc tweaks * remove unneccesary declaration * make it work without allow-same-origin, add loading=lazy * remove loading attribute, does not seem to work * rename variable * skip roundtrip to DOM for rendering * don't guess chart height * update comment to make it clear it's intentional * tweak * replace deprecated 'scrolling' property * remove unused css file Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix source code line highlighting (#18729)Jimmy Praet2022-02-121-2/+5
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add LDAP group sync to Teams, fixes #1395 (#16299)Sven Seeberg2022-02-111-10/+6
| | | | | | | | | | * Add setting for a JSON that maps LDAP groups to Org Teams. * Add log when removing or adding team members. * Sync is being run on login and periodically. * Existing group filter settings are reused. * Adding and removing team members. * Sync not existing LDAP group. * Login with broken group map JSON.
* Add apply-patch, basic revert and cherry-pick functionality (#17902)zeripath2022-02-094-12/+90
| | | | | | | | | | | | | | | This code adds a simple endpoint to apply patches to repositories and branches on gitea. This is then used along with the conflicting checking code in #18004 to provide a basic implementation of cherry-pick revert. Now because the buttons necessary for cherry-pick and revert have required us to create a dropdown next to the Browse Source button I've also implemented Create Branch and Create Tag operations. Fix #3880 Fix #17986 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prevent security failure due to bad APP_ID (#18678)zeripath2022-02-091-0/+13
| | | | | | | | | | | WebAuthn may cause a security exception if the provided APP_ID is not allowed for the current origin. Therefore we should reattempt authentication without the appid extension. Also we should allow [u2f] as-well as [U2F] sections. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix review excerpt (#18502)confusedsushi2022-02-011-1/+3
| | | | | | | | | | | | | | | | | Currently the "File Changed" tab of a PR is somehow broken. This is also true for the current release 1.16.0. When you are on the "File Changed" tab, and want to look at code excerpt before or after the code changes, the layout breaks. You can test this on try.gitea.io here: https://try.gitea.io/testnotexisting/magic_enum/pulls/2/files The problem occurs for the unified view and for the split view. Kind of the same problem was there for commenting a line of code, this was fixed in #18321 and #18403. For consistency, I changed the solution of #18321, I removed the ``colspan`` and instead added a ``<td>``. The goal was to have code similarly with the split view. Also the separator line in the split view was in the wrong column, this was fixed too.* more consistent unified review comment Fix #18516 Co-authored-by: Andrew Thornton <art27@cantab.net>
* Use explicit jQuery import, remove unused eslint globals (#18435)silverwind2022-01-2850-14/+76
| | | | | - Don't rely on globals (window.$) for jQuery import - Remove eslint globals no longer in use
* Place inline diff comment dialogs on split diff in 4th and 8th columns (#18403)zeripath2022-01-251-0/+2
| | | | | | Fix #18391 Fix #18320 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prevent showing webauthn error for every time visiting ↵wxiaoguang2022-01-241-4/+3
| | | | `/user/settings/security` (#18385)
* Fix PR comments UI (#18323)wxiaoguang2022-01-192-2/+2
| | | | | Closes: * Review comment cannot be edited #17768 * Changing PR Comment Resolved State Disables Further Changes #18315
* Make the height of the editor in Review Box smaller (4 lines as GitHub) (#18319)wxiaoguang2022-01-192-4/+7
| | | And shrink the height of Dropzone.
* Place inline diff comment dialogs in the 4th column. (#18321)JonRB2022-01-181-1/+1
| | | | | | | | | | | | Comment dialogs for inline comments should appear in 4th column (not 3rd column), this PR changes the column that the inline review comment is associated with. This problem has occurred due to an unrecognised conflict between #17562 and #17315. Fix as zeripath suggested in #18320 Fix #18320 Co-authored-by: zeripath <art27@cantab.net>
* Revert "Prevent possible XSS when using jQuery (#18289)" (#18293)wxiaoguang2022-01-169-34/+34
| | | This reverts commit 661d3d28e97bb49bef075c0314edad5879148aaa.
* Prevent possible XSS when using jQuery (#18289)Gusted2022-01-169-34/+34
| | | | | | | In the case of misuse or misunderstanding from a developer whereby, if `sel` can receive user-controlled data, jQuery `$(sel)` can lead to the creation of a new element. Current usage is using hard-coded selectors in the templates, but nobody prevents that from expanding to user-controlled somehow.
* Webauthn nits (#18284)zeripath2022-01-151-8/+11
| | | | | | | This contains some additional fixes and small nits related to #17957 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support webauthn (#17957)Lunny Xiao2022-01-143-128/+200
| | | | | | | Migrate from U2F to Webauthn Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix EasyMDE image paste bug during refactoring (#18207)wxiaoguang2022-01-082-4/+9
|
* Fix CSS specificity issue with easymde's css (#18201)silverwind2022-01-071-1/+1
| | | | | | | | | | | | | | | | * Fix CSS specificity issue with easymde's css PR #18069 introduced a regression in certain overwritten editor styles because the dynamic loading of easymde.min.css causes its's style to apply after our supposed override styles. Solve this by bundling the styles into index.css. We should later aim to completely replace easymde.min.css completely with our own styles so there are no more conflicts. * Update web_src/js/features/comp/EasyMDE.js Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add warning for BIDI characters in page renders and in diffs (#17562)zeripath2022-01-073-1/+44
| | | | | | | | | | | | Fix #17514 Given the comments I've adjusted this somewhat. The numbers of characters detected are increased and include things like the use of U+300 to make à instead of à and non-breaking spaces. There is a button which can be used to escape the content to show it. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Gwyneth Morgan <gwymor@tilde.club> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Load EasyMDE/CodeMirror dynamically, remove RequireEasyMDE (#18069)wxiaoguang2022-01-057-187/+237
| | | This PR makes frontend load EasyMDE/CodeMirror dynamically, and removes `RequireEasyMDE`.
* Fix EasyMDE validation (#18161)wxiaoguang2022-01-033-24/+40
|
* Require codereview to have content (#18156)Gusted2022-01-023-13/+38
| | | | | - Report a validityError when the codeReview have no comment. - Resolves #18151 - Refactor
* Handle invalid issues (#18111)Gusted2021-12-281-8/+20
| | | | | | | | | | | | | | | | | | | | | | | * Handle invalid issues - When you hover over a issue reference, and the issue doesn't exist, it will just hang on the loading animation. - This patch fixes that by showing them the pop-up with a "Error occured" message. * Add I18N * refactor * fix comment for lint * fix unit test for i18n * fix unit test for i18n * add comments Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Clean legacy SimpleMDE code (#17926)wxiaoguang2021-12-107-61/+83
| | | | | | | | | | | Since we are using EasyMDE now, we do not need to keep the SimpleMDE code anymore. This PR removes all legacy SimpleMDE code, and makes some related changes: * `createCommentEasyMDE` can accept native DOM element, and it doesn't need `jQuery.data` to store EasyMDE editor object (as discussed about the frontend guideline). * introduce `getAttachedEasyMDE` to get the attached EasyMDE editor object, it's easier to find all the usage of EasyMDE. * rename variable names from `$simplemde` to `easyMDE`, the `$` was incorrect because it is a EasyMDE editor, not a jQuery object. With this PR, it will be easier to do more refactoring or replacing EasyMDE with other editors.
* Support sorting for project board issuses (#17152)Anbraten2021-12-081-14/+26
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove unnecessary `X-Remote` HTTP header in AJAX request (#17932)wxiaoguang2021-12-082-7/+0
|
* Refactor install page (db type) (#17919)wxiaoguang2021-12-071-36/+27
| | | | | | | | | | | | * Refactor install page (db type) * set correct default DB HOST for different DB TYPE * remove legacy TiDB from documents * unify the usage of DB TYPE, in code we only use "mysql". "MySQL" is only shown to users for friendly name. * Gitea can use TiDB via MySQL protocol Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix loading content history on show more (#17819)Gusted2021-12-061-1/+3
| | | | | | | | | | | | | | | * Fix loading content history on show more - Call `initRepoIssueContentHistory` so that the newly loaded issues also get their content history. - Resolves #17767 * apply history to show diff too Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Update JS dependencies, adjust eslint config (#17904)silverwind2021-12-044-6/+5
| | | | | - Update all JS dependencies to latest versions - Add new lint rules, enable es2022 eslint parser features - Disable github/no-then, I feel the rule was too restricting
* Added missing `data-` prefix. (#17884)KN4CK3R2021-12-031-3/+3
|
* Switch archive URL code back to href attributes (#17796)fnetX (aka fralix)2021-11-291-1/+1
| | | | | | * Add fallback href link * Switch async archive generation to use href links * Edit all templates to use href instead of data-url for archives * Add consistent rel="nofollow" as per wxiaoguang
* Detect dark theme via css variable (#17800)ThetaDev2021-11-251-7/+2
| | | | | | | * detect dark theme via css variable * minor refactor, add documentation If your custom theme is considered a dark theme, set the global css variable `--is-dark-theme` to `true`. This allows gitea to adjust the Monaco code editor's theme accordingly.
* Improve ellipsis buttons (#17773)silverwind2021-11-222-4/+6
| | | | | | | | | | | | * Improve ellipsis buttons - Remove icon font usage - Add aria-expanded attribute * rename function to match Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>