Skip to content

Fixes #7152 - Allow create/update/delete message to be empty, use default message #7324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

richmahn
Copy link
Contributor

Fixed #7152 - the swagger comment for the "message" field for the API request for Create/Update/Delete says to be optional, but failed if not supplied. Now, like the web interface, uses a default message ("Add file.txt", "Update file.txt" and "Delete `file.txt" respectively) like the web edit/delete interface does.

@richmahn richmahn mentioned this pull request Jun 28, 2019
7 tasks
@richmahn richmahn changed the title Fixes #7152 - Allow create/update/delete message to be empty, use def… Fixes #7152 - Allow create/update/delete message to be empty, use default message Jun 28, 2019
@codecov-io
Copy link

codecov-io commented Jun 28, 2019

Codecov Report

Merging #7324 into master will increase coverage by <.01%.
The diff coverage is 78.57%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #7324      +/-   ##
=========================================
+ Coverage    41.2%   41.2%   +<.01%     
=========================================
  Files         464     464              
  Lines       62938   62952      +14     
=========================================
+ Hits        25932   25938       +6     
- Misses      33612   33622      +10     
+ Partials     3394    3392       -2
Impacted Files Coverage Δ
routers/api/v1/repo/file.go 69.08% <100%> (+0.88%) ⬆️
modules/repofiles/delete.go 52.73% <25%> (-0.79%) ⬇️
models/unit.go 62.16% <0%> (-5.41%) ⬇️
modules/log/event.go 64.61% <0%> (-1.03%) ⬇️
routers/repo/view.go 42.23% <0%> (-1.02%) ⬇️
modules/repofiles/file.go 83.33% <0%> (+3.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 462284e...fcc67ba. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 28, 2019
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 28, 2019
@lunny
Copy link
Member

lunny commented Jun 29, 2019

The message could be saved on locale file so that users could define it themselves.

@richmahn
Copy link
Contributor Author

@lunny Don't quite understand what you are saying. It uses the locale text like the web interface does.

@@ -28,7 +28,7 @@ func getCreateFileOptions() api.CreateFileOptions {
FileOptions: api.FileOptions{
BranchName: "master",
NewBranchName: "master",
Message: "Creates new/file.txt",
Message: "Making this new file new/file.txt",
Copy link
Member

@lunny lunny Jun 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richmahn I mean we can use a translated message here. This will not block this PR.

Message: ctx.Tr("my language message")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why worry about translating a message in the integration test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you were just showing that as an example, but with GitHub there is no translation done with commit messages. But right, not the issue addressed by this PR, as it is just giving the default editor.repo.add, editor.repo.update, editor.repo.delete messages if message is empty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @richmahn I don't think we should be trying to translate messages in the integration tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richmahn Oh. it's a test file. Ignore my words above.

Copy link
Contributor Author

@richmahn richmahn Jun 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a message should never be translated, but as the user intended. Only when it is auto-generated should it be translated. There may be a problem to as what if for some reason they actually wanted to write something like "template" or "home" which would get translated to "Template" or "Home" from our locale_en-US.ini file... while not a big change, it would boggle them why the message is getting uppercased.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 29, 2019
@lunny lunny added the type/bug label Jun 29, 2019
@lunny lunny added this to the 1.9.0 milestone Jun 29, 2019
@zeripath zeripath merged commit 002b597 into go-gitea:master Jun 29, 2019
jeffliu27 pushed a commit to jeffliu27/gitea that referenced this pull request Jul 18, 2019
… use default message (go-gitea#7324)

* Fixes go-gitea#7152 - Allow create/update/delete message to be empty, use default message

* Linting fix

* Fix to delete integration tests
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't create file via API
5 participants