Merge remote-tracking branch 'upstream/main' into sync-issue-pr-and-more

This commit is contained in:
harryzcy 2022-07-19 15:28:06 -04:00
commit 5a1dda4ad7
22 changed files with 283 additions and 42 deletions

View File

@ -632,9 +632,10 @@ func runListUsers(c *cli.Context) error {
}
}
} else {
fmt.Fprintf(w, "ID\tUsername\tEmail\tIsActive\tIsAdmin\n")
twofa := user_model.UserList(users).GetTwoFaStatus()
fmt.Fprintf(w, "ID\tUsername\tEmail\tIsActive\tIsAdmin\t2FA\n")
for _, u := range users {
fmt.Fprintf(w, "%d\t%s\t%s\t%t\t%t\n", u.ID, u.Name, u.Email, u.IsActive, u.IsAdmin)
fmt.Fprintf(w, "%d\t%s\t%s\t%t\t%t\t%t\n", u.ID, u.Name, u.Email, u.IsActive, u.IsAdmin, twofa[u.ID])
}
}

View File

@ -78,6 +78,13 @@ Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
###
# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
# set the following value to false to allow capabilities to be applied on gitea process. The following
# value if set to true sandboxes gitea service and prevent any processes from running with privileges
# in the host user namespace.
###
#PrivateUsers=false
###
[Install]
WantedBy=multi-user.target

View File

@ -19,6 +19,7 @@ import (
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
"xorm.io/builder"
)
@ -474,6 +475,35 @@ func SubmitReview(doer *user_model.User, issue *Issue, reviewType ReviewType, co
return review, comm, committer.Commit()
}
// GetReviewOptions represent filter options for GetReviews
type GetReviewOptions struct {
IssueID int64
ReviewerID int64
Dismissed util.OptionalBool
}
// GetReviews return reviews based on GetReviewOptions
func GetReviews(ctx context.Context, opts *GetReviewOptions) ([]*Review, error) {
if opts == nil {
return nil, fmt.Errorf("opts are nil")
}
sess := db.GetEngine(ctx)
if opts.IssueID != 0 {
sess = sess.Where("issue_id=?", opts.IssueID)
}
if opts.ReviewerID != 0 {
sess = sess.Where("reviewer_id=?", opts.ReviewerID)
}
if !opts.Dismissed.IsNone() {
sess = sess.Where("dismissed=?", opts.Dismissed.IsTrue())
}
reviews := make([]*Review, 0, 4)
return reviews, sess.Find(&reviews)
}
// GetReviewersByIssueID gets the latest review of each reviewer for a pull request
func GetReviewersByIssueID(issueID int64) ([]*Review, error) {
reviews := make([]*Review, 0, 10)

View File

@ -97,6 +97,7 @@ type SubmitPullReviewOptions struct {
// DismissPullReviewOptions are options to dismiss a pull review
type DismissPullReviewOptions struct {
Message string `json:"message"`
Priors bool `json:"priors"`
}
// PullReviewRequestOptions are options to add or remove pull review requests

View File

@ -6,7 +6,7 @@
/bazel-*
# Directories for the Bazel IntelliJ plugin containing the generated
# IntelliJ project files and plugin configuration. Separate directories are
# IntelliJ project files and plugin configuration. Seperate directories are
# for the IntelliJ, Android Studio and CLion versions of the plugin.
/.ijwb/
/.aswb/

View File

@ -0,0 +1 @@
The Totem project hereby grant permission for non-gpl compatible GStreamer plugins to be used and distributed together with GStreamer and Totem. This permission are above and beyond the permissions granted by the GPL license Totem is covered by.

View File

@ -0,0 +1 @@
This project hereby grants permission for non-GPL compatible GStreamer plugins to be used and distributed together with GStreamer and this project. This permission is above and beyond the permissions granted by the GPL license by which this project is covered. If you modify this code, you may extend this exception to your version of the code, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.

51
options/license/Minpack Normal file
View File

@ -0,0 +1,51 @@
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
3. The end-user documentation included with the
redistribution, if any, must include the following
acknowledgment:
"This product includes software developed by the
University of Chicago, as Operator of Argonne National
Laboratory.
Alternately, this acknowledgment may appear in the software
itself, if and wherever such third-party acknowledgments
normally appear.
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
BE CORRECTED.
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
POSSIBILITY OF SUCH LOSS OR DAMAGES.

View File

@ -1420,7 +1420,7 @@ issues.due_date_form_remove = "Remove"
issues.due_date_not_writer = "You need repository write access to update an issue's due date."
issues.due_date_not_set = "No due date set."
issues.due_date_added = "added the due date %s %s"
issues.due_date_modified = "modified the due date to %s from %s %s"
issues.due_date_modified = "modified the due date from %[2]s to %[1]s %[3]s"
issues.due_date_remove = "removed the due date %s %s"
issues.due_date_overdue = "Overdue"
issues.due_date_invalid = "The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'."

31
package-lock.json generated
View File

@ -29,6 +29,7 @@
"pretty-ms": "7.0.1",
"sortablejs": "1.15.0",
"swagger-ui-dist": "4.11.1",
"tippy.js": "6.3.7",
"tributejs": "5.1.3",
"uint8-to-base64": "0.2.0",
"vue": "2.6.14",
@ -1599,6 +1600,15 @@
"node": ">= 8"
}
},
"node_modules/@popperjs/core": {
"version": "2.11.5",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.5.tgz",
"integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@primer/octicons": {
"version": "17.2.0",
"resolved": "https://registry.npmjs.org/@primer/octicons/-/octicons-17.2.0.tgz",
@ -11400,6 +11410,14 @@
"integrity": "sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w==",
"dev": true
},
"node_modules/tippy.js": {
"version": "6.3.7",
"resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz",
"integrity": "sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==",
"dependencies": {
"@popperjs/core": "^2.9.0"
}
},
"node_modules/tmpl": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
@ -13567,6 +13585,11 @@
"fastq": "^1.6.0"
}
},
"@popperjs/core": {
"version": "2.11.5",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.5.tgz",
"integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw=="
},
"@primer/octicons": {
"version": "17.2.0",
"resolved": "https://registry.npmjs.org/@primer/octicons/-/octicons-17.2.0.tgz",
@ -21235,6 +21258,14 @@
"integrity": "sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w==",
"dev": true
},
"tippy.js": {
"version": "6.3.7",
"resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz",
"integrity": "sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==",
"requires": {
"@popperjs/core": "^2.9.0"
}
},
"tmpl": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",

View File

@ -29,6 +29,7 @@
"pretty-ms": "7.0.1",
"sortablejs": "1.15.0",
"swagger-ui-dist": "4.11.1",
"tippy.js": "6.3.7",
"tributejs": "5.1.3",
"uint8-to-base64": "0.2.0",
"vue": "2.6.14",

View File

@ -823,7 +823,7 @@ func DismissPullReview(ctx *context.APIContext) {
// "422":
// "$ref": "#/responses/validationError"
opts := web.GetForm(ctx).(*api.DismissPullReviewOptions)
dismissReview(ctx, opts.Message, true)
dismissReview(ctx, opts.Message, true, opts.Priors)
}
// UnDismissPullReview cancel to dismiss a review for a pull request
@ -863,10 +863,10 @@ func UnDismissPullReview(ctx *context.APIContext) {
// "$ref": "#/responses/forbidden"
// "422":
// "$ref": "#/responses/validationError"
dismissReview(ctx, "", false)
dismissReview(ctx, "", false, false)
}
func dismissReview(ctx *context.APIContext, msg string, isDismiss bool) {
func dismissReview(ctx *context.APIContext, msg string, isDismiss, dismissPriors bool) {
if !ctx.Repo.IsAdmin() {
ctx.Error(http.StatusForbidden, "", "Must be repo admin")
return
@ -886,7 +886,7 @@ func dismissReview(ctx *context.APIContext, msg string, isDismiss bool) {
return
}
_, err := pull_service.DismissReview(ctx, review.ID, ctx.Repo.Repository.ID, msg, ctx.Doer, isDismiss)
_, err := pull_service.DismissReview(ctx, review.ID, ctx.Repo.Repository.ID, msg, ctx.Doer, isDismiss, dismissPriors)
if err != nil {
ctx.Error(http.StatusInternalServerError, "pull_service.DismissReview", err)
return

View File

@ -45,6 +45,7 @@ func Members(ctx *context.Context) {
}
opts.PublicOnly = !isMember && !ctx.Doer.IsAdmin
}
ctx.Data["PublicOnly"] = opts.PublicOnly
total, err := organization.CountOrgMembers(opts)
if err != nil {

View File

@ -242,7 +242,7 @@ func SubmitReview(ctx *context.Context) {
// DismissReview dismissing stale review by repo admin
func DismissReview(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.DismissReviewForm)
comm, err := pull_service.DismissReview(ctx, form.ReviewID, ctx.Repo.Repository.ID, form.Message, ctx.Doer, true)
comm, err := pull_service.DismissReview(ctx, form.ReviewID, ctx.Repo.Repository.ID, form.Message, ctx.Doer, true, true)
if err != nil {
ctx.ServerError("pull_service.DismissReview", err)
return

View File

@ -20,6 +20,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
)
// CreateCodeComment creates a comment on the code line
@ -271,7 +272,7 @@ func SubmitReview(ctx context.Context, doer *user_model.User, gitRepo *git.Repos
}
// DismissReview dismissing stale review by repo admin
func DismissReview(ctx context.Context, reviewID, repoID int64, message string, doer *user_model.User, isDismiss bool) (comment *issues_model.Comment, err error) {
func DismissReview(ctx context.Context, reviewID, repoID int64, message string, doer *user_model.User, isDismiss, dismissPriors bool) (comment *issues_model.Comment, err error) {
review, err := issues_model.GetReviewByID(ctx, reviewID)
if err != nil {
return
@ -295,6 +296,22 @@ func DismissReview(ctx context.Context, reviewID, repoID int64, message string,
return
}
if dismissPriors {
reviews, err := issues_model.GetReviews(ctx, &issues_model.GetReviewOptions{
IssueID: review.IssueID,
ReviewerID: review.ReviewerID,
Dismissed: util.OptionalBoolFalse,
})
if err != nil {
return nil, err
}
for _, oldReview := range reviews {
if err = issues_model.DismissReview(oldReview, true); err != nil {
return nil, err
}
}
}
if !isDismiss {
return nil, nil
}

View File

@ -29,28 +29,30 @@
{{end}}
</div>
</div>
<div class="ui three wide column center">
<div class="meta">
{{$.locale.Tr "org.members.member_role"}}
{{if not .PublicOnly}}
<div class="ui three wide column center">
<div class="meta">
{{$.locale.Tr "org.members.member_role"}}
</div>
<div class="meta">
<strong>{{if index $.MembersIsUserOrgOwner .ID}}{{svg "octicon-shield-lock"}} {{$.locale.Tr "org.members.owner"}}{{else}}{{$.locale.Tr "org.members.member"}}{{end}}</strong>
</div>
</div>
<div class="meta">
<strong>{{if index $.MembersIsUserOrgOwner .ID}}{{svg "octicon-shield-lock"}} {{$.locale.Tr "org.members.owner"}}{{else}}{{$.locale.Tr "org.members.member"}}{{end}}</strong>
<div class="ui two wide column center">
<div class="meta">
{{$.locale.Tr "admin.users.2fa"}}
</div>
<div class="meta">
<strong>
{{if index $.MembersTwoFaStatus .ID}}
<span class="text green">{{svg "octicon-check"}}</span>
{{else}}
{{svg "octicon-x"}}
{{end}}
</strong>
</div>
</div>
</div>
<div class="ui two wide column center">
<div class="meta">
{{$.locale.Tr "admin.users.2fa"}}
</div>
<div class="meta">
<strong>
{{if index $.MembersTwoFaStatus .ID}}
<span class="text green">{{svg "octicon-check"}}</span>
{{else}}
{{svg "octicon-x"}}
{{end}}
</strong>
</div>
</div>
{{end}}
<div class="ui three wide column">
<div class="text right">
{{if eq $.SignedUser.ID .ID}}

View File

@ -340,7 +340,8 @@
</a>
<span class="text grey">
<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
{{$.locale.Tr "repo.issues.due_date_modified" (.Content | ParseDeadline) $createdStr | Safe}}
{{$parsedDeadline := .Content | ParseDeadline}}
{{$.locale.Tr "repo.issues.due_date_modified" (index $parsedDeadline 0) (index $parsedDeadline 1) $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 18}}

View File

@ -14864,6 +14864,10 @@
"message": {
"type": "string",
"x-go-name": "Message"
},
"priors": {
"type": "boolean",
"x-go-name": "Priors"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"

View File

@ -2,6 +2,7 @@ import $ from 'jquery';
import Vue from 'vue';
import ContextPopup from '../components/ContextPopup.vue';
import {parseIssueHref} from '../utils.js';
import {createTippy} from '../modules/tippy.js';
export default function initContextPopups() {
const refIssues = $('.ref-issue');
@ -16,7 +17,6 @@ export default function initContextPopups() {
if (!owner) return;
const el = document.createElement('div');
el.className = 'ui custom popup hidden';
el.innerHTML = '<div></div>';
this.parentNode.insertBefore(el, this.nextSibling);
@ -33,17 +33,12 @@ export default function initContextPopups() {
el.textContent = 'ContextPopup failed to load';
}
$(this).popup({
variation: 'wide',
delay: {
show: 250
},
createTippy(this, {
content: el,
interactive: true,
onShow: () => {
view.$emit('load-context-popup', {owner, repo, index}, () => {
$(this).popup('reposition');
});
},
popup: $(el),
view.$emit('load-context-popup', {owner, repo, index});
}
});
});
}

View File

@ -0,0 +1,12 @@
import tippy from 'tippy.js';
export function createTippy(target, opts) {
return tippy(target, {
appendTo: document.body,
placement: 'top-start',
animation: false,
allowHTML: true,
arrow: `<svg width="16" height="7"><path d="m0 7 8-7 8 7Z" class="tippy-svg-arrow-outer"/><path d="m0 8 8-7 8 7Z" class="tippy-svg-arrow-inner"/></svg>`,
...opts,
});
}

View File

@ -9,6 +9,7 @@
@import "./features/imagediff.less";
@import "./features/codeeditor.less";
@import "./features/projects.less";
@import "./modules/tippy.less";
@import "./markup/content.less";
@import "./markup/codecopy.less";
@import "./code/linebutton.less";

View File

@ -0,0 +1,84 @@
/* styles are based on node_modules/tippy.js/dist/tippy.css */
.tippy-box[data-animation="fade"][data-state="hidden"] {
opacity: 0;
}
[data-tippy-root] {
max-width: calc(100vw - 10px);
}
.tippy-box {
position: relative;
background-color: var(--color-body);
color: var(--color-secondary-dark-6);
border: 1px solid var(--color-secondary);
border-radius: var(--border-radius);
font-size: 1rem;
transition-property: transform, visibility, opacity;
}
.tippy-content {
position: relative;
padding: 1rem;
z-index: 1;
}
.tippy-box[data-placement^="top"] > .tippy-svg-arrow {
bottom: 0;
}
.tippy-box[data-placement^="top"] > .tippy-svg-arrow::after,
.tippy-box[data-placement^="top"] > .tippy-svg-arrow > svg {
top: 16px;
transform: rotate(180deg);
}
.tippy-box[data-placement^="bottom"] > .tippy-svg-arrow {
top: 0;
}
.tippy-box[data-placement^="bottom"] > .tippy-svg-arrow > svg {
bottom: 16px;
}
.tippy-box[data-placement^="left"] > .tippy-svg-arrow {
right: 0;
}
.tippy-box[data-placement^="left"] > .tippy-svg-arrow::after,
.tippy-box[data-placement^="left"] > .tippy-svg-arrow > svg {
transform: rotate(90deg);
top: calc(50% - 3px);
left: 11px;
}
.tippy-box[data-placement^="right"] > .tippy-svg-arrow {
left: 0;
}
.tippy-box[data-placement^="right"] > .tippy-svg-arrow::after,
.tippy-box[data-placement^="right"] > .tippy-svg-arrow > svg {
transform: rotate(-90deg);
top: calc(50% - 3px);
right: 11px;
}
.tippy-svg-arrow {
width: 16px;
height: 16px;
text-align: initial;
}
.tippy-svg-arrow,
.tippy-svg-arrow > svg {
position: absolute;
}
.tippy-svg-arrow-outer {
fill: var(--color-secondary);
}
.tippy-svg-arrow-inner {
fill: var(--color-body);
}