Skip to content

Commit

Permalink
Merge remote-tracking branch 'giteaofficial/main'
Browse files Browse the repository at this point in the history
* giteaofficial/main:
  Fix PR creation via api between branches of same repo with head field namespaced (go-gitea#26986)
  Remove fomantic message module (go-gitea#29856)
  fix double border and border-radius on empty action steps (go-gitea#29845)
  add `.suppressed` link class (go-gitea#29847)
  • Loading branch information
zjjhot committed Mar 17, 2024
2 parents 49462d6 + ed02d1f commit 28b16f6
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 756 deletions.
2 changes: 2 additions & 0 deletions routers/api/v1/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,8 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption)
return nil, nil, nil, nil, "", ""
}
headBranch = headInfos[1]
// The head repository can also point to the same repo
isSameRepo = ctx.Repo.Owner.ID == headUser.ID

} else {
ctx.NotFound()
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/api_pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,23 @@ func TestAPICreatePullSuccess(t *testing.T) {
MakeRequest(t, req, http.StatusUnprocessableEntity) // second request should fail
}

func TestAPICreatePullSameRepoSuccess(t *testing.T) {
defer tests.PrepareTestEnv(t)()
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})

session := loginUser(t, owner.Name)
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)

req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls", owner.Name, repo.Name), &api.CreatePullRequestOption{
Head: fmt.Sprintf("%s:pr-to-update", owner.Name),
Base: "master",
Title: "successfully create a PR between branches of the same repository",
}).AddTokenAuth(token)
MakeRequest(t, req, http.StatusCreated)
MakeRequest(t, req, http.StatusUnprocessableEntity) // second request should fail
}

func TestAPICreatePullWithFieldsSuccess(t *testing.T) {
defer tests.PrepareTestEnv(t)()
// repo10 have code, pulls units.
Expand Down
81 changes: 11 additions & 70 deletions web_src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,32 @@ a {
text-decoration-skip-ink: all;
}

/* muted link = only colored when hovered */
/* silenced link = never colored */
/* a = always colored, underlined on hover */
/* a.muted = colored on hover, underlined on hover */
/* a.suppressed = never colored, underlined on hover */
/* a.silenced = never colored, never underlined */

a.muted,
a.suppressed,
a.silenced,
.muted-links a {
color: inherit;
}

a:hover,
a.suppressed:hover,
a.muted:hover,
a.muted:hover [class*="color-text"],
.muted-links a:hover {
color: var(--color-primary);
}

a.silenced:hover {
a.silenced:hover,
a.suppressed:hover {
color: inherit;
}

a.silenced:hover {
text-decoration: none;
}

Expand Down Expand Up @@ -502,73 +510,6 @@ ol.ui.list li,
visibility: visible !important;
}

.ui.message {
background: var(--color-box-body);
color: var(--color-text);
box-shadow: none !important;
border: 1px solid var(--color-secondary);
}

.ui.info.message .header,
.ui.blue.message .header {
color: var(--color-blue);
}

.ui.info.message,
.ui.attached.info.message,
.ui.blue.message,
.ui.attached.blue.message {
background: var(--color-info-bg);
color: var(--color-info-text);
border-color: var(--color-info-border);
}

.ui.success.message .header,
.ui.positive.message .header,
.ui.green.message .header {
color: var(--color-green);
}

.ui.success.message,
.ui.attached.success.message,
.ui.positive.message,
.ui.attached.positive.message {
background: var(--color-success-bg);
color: var(--color-success-text);
border-color: var(--color-success-border);
}

.ui.error.message .header,
.ui.negative.message .header,
.ui.red.message .header {
color: var(--color-red);
}

.ui.error.message,
.ui.attached.error.message,
.ui.red.message,
.ui.attached.red.message,
.ui.negative.message,
.ui.attached.negative.message {
background: var(--color-error-bg);
color: var(--color-error-text);
border-color: var(--color-error-border);
}

.ui.warning.message .header,
.ui.yellow.message .header {
color: var(--color-yellow);
}

.ui.warning.message,
.ui.attached.warning.message,
.ui.yellow.message,
.ui.attached.yellow.message {
background: var(--color-warning-bg);
color: var(--color-warning-text);
border-color: var(--color-warning-border);
}

.ui.error.header {
background: var(--color-error-bg) !important;
color: var(--color-error-text) !important;
Expand Down
1 change: 1 addition & 0 deletions web_src/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@import "./modules/divider.css";
@import "./modules/svg.css";
@import "./modules/flexcontainer.css";
@import "./modules/message.css";

@import "./shared/flex-list.css";
@import "./shared/milestone.css";
Expand Down
99 changes: 99 additions & 0 deletions web_src/css/modules/message.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.ui.message {
background: var(--color-box-body);
color: var(--color-text);
border: 1px solid var(--color-secondary);
position: relative;
min-height: 1em;
margin: 1em 0;
padding: 1em 1.5em;
border-radius: var(--border-radius);
}

.ui.message:first-child {
margin-top: 0;
}

.ui.message:last-child {
margin-bottom: 0;
}

.ui.attached.message {
margin-bottom: -1px;
border-radius: var(--border-radius) var(--border-radius) 0 0;
margin-left: -1px;
margin-right: -1px;
}

.ui.attached + .ui.attached.message:not(.top):not(.bottom) {
margin-top: -1px;
border-radius: 0;
}

.ui.bottom.attached.message {
margin-top: -1px;
border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.ui.bottom.attached.message:not(:last-child) {
margin-bottom: 1em;
}

.ui.info.message .header,
.ui.blue.message .header {
color: var(--color-blue);
}

.ui.info.message,
.ui.attached.info.message,
.ui.blue.message,
.ui.attached.blue.message {
background: var(--color-info-bg);
color: var(--color-info-text);
border-color: var(--color-info-border);
}

.ui.success.message .header,
.ui.positive.message .header,
.ui.green.message .header {
color: var(--color-green);
}

.ui.success.message,
.ui.attached.success.message,
.ui.positive.message,
.ui.attached.positive.message {
background: var(--color-success-bg);
color: var(--color-success-text);
border-color: var(--color-success-border);
}

.ui.error.message .header,
.ui.negative.message .header,
.ui.red.message .header {
color: var(--color-red);
}

.ui.error.message,
.ui.attached.error.message,
.ui.red.message,
.ui.attached.red.message,
.ui.negative.message,
.ui.attached.negative.message {
background: var(--color-error-bg);
color: var(--color-error-text);
border-color: var(--color-error-border);
}

.ui.warning.message .header,
.ui.yellow.message .header {
color: var(--color-yellow);
}

.ui.warning.message,
.ui.attached.warning.message,
.ui.yellow.message,
.ui.attached.yellow.message {
background: var(--color-warning-bg);
color: var(--color-warning-text);
border-color: var(--color-warning-border);
}
Loading

0 comments on commit 28b16f6

Please sign in to comment.