Skip to content
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

Notification API should always return a JSON object with the current count of notifications #10059

Merged

Conversation

6543
Copy link
Member

@6543 6543 commented Jan 29, 2020

it makes it way more easyer for clients if there is always a json they can parse if they like ...
or just check the http Status ...

also included: smal code format

@6543 6543 requested a review from zeripath January 29, 2020 13:08
@6543
Copy link
Member Author

6543 commented Jan 29, 2020

@zeripath your PR introduced a formation error - but CI passed ?!? ...

anywai here it corectes it ... :)

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 29, 2020
@codecov-io
Copy link

codecov-io commented Jan 29, 2020

Codecov Report

Merging #10059 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10059      +/-   ##
==========================================
+ Coverage   43.46%   43.48%   +0.01%     
==========================================
  Files         597      597              
  Lines       84713    84704       -9     
==========================================
+ Hits        36824    36831       +7     
+ Misses      43348    43333      -15     
+ Partials     4541     4540       -1     
Impacted Files Coverage Δ
routers/api/v1/notify/notifications.go 100.00% <100.00%> (ø)
modules/log/event.go 65.64% <0.00%> (+1.02%) ⬆️
modules/queue/workerpool.go 59.07% <0.00%> (+1.06%) ⬆️
modules/queue/unique_queue_disk_channel.go 55.76% <0.00%> (+1.92%) ⬆️
models/unit.go 44.44% <0.00%> (+2.46%) ⬆️
modules/indexer/stats/db.go 50.00% <0.00%> (+9.37%) ⬆️
modules/indexer/stats/queue.go 81.25% <0.00%> (+18.75%) ⬆️

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 c97e988...826346a. Read the comment docs.

@6543
Copy link
Member Author

6543 commented Jan 29, 2020

from discord:
"Hmm http.StatusNoContent should have no response payload
If you want to have results you should probably change it to a StatusOK
I appreciate that breaks the cool status code semantics"

@zeripath
Copy link
Contributor

I think you have to change the status code if you're going to return content.

@6543
Copy link
Member Author

6543 commented Jan 29, 2020

@zeripath I like to keep the abilety to check if you have unread notify. on the statusCode

@6543 6543 closed this Jan 29, 2020
@6543 6543 deleted the api-check-notify_always-json branch January 29, 2020 18:16
@6543 6543 restored the api-check-notify_always-json branch April 8, 2020 00:32
@6543 6543 reopened this Apr 8, 2020
@6543 6543 force-pushed the api-check-notify_always-json branch from 5f2a1a9 to 95b13e3 Compare April 8, 2020 00:42
@6543
Copy link
Member Author

6543 commented Apr 8, 2020

Reason For reopen: I was reasently asked If I can change this, since it would be mouch easyer to use ...

@6543 6543 force-pushed the api-check-notify_always-json branch from 95b13e3 to 948b007 Compare April 8, 2020 00:54
@6543
Copy link
Member Author

6543 commented Apr 8, 2020

I think you have to change the status code if you're going to return content.

to witch one? https://httpstatuses.com/

I still think 204 is the closesd match

@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 Apr 8, 2020
@6543 6543 force-pushed the api-check-notify_always-json branch from f3f4ee2 to 533f52a Compare April 9, 2020 12:41
@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 Apr 10, 2020
@lafriks lafriks added the modifies/api This PR adds API routes or modifies them label Apr 10, 2020
@lafriks lafriks added this to the 1.12.0 milestone Apr 10, 2020
@6543
Copy link
Member Author

6543 commented Apr 10, 2020

ping lgmt

@techknowlogick techknowlogick merged commit 0dadea1 into go-gitea:master Apr 10, 2020
@6543 6543 deleted the api-check-notify_always-json branch April 10, 2020 23:55
@lunny lunny added the pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! label Apr 11, 2020
@zeripath zeripath changed the title [Api] Check Notify (always return json) Notification API should always return a JSON object with the current count of notifications May 17, 2020
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
* BEAKING: check return status based on struct not httpStatus

* update Tests

* CI.restart()
@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. modifies/api This PR adds API routes or modifies them pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants