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

More Issue-Comments API-endpoints #3624

Merged
merged 2 commits into from
Dec 21, 2016
Merged

Conversation

bkcsoft
Copy link
Contributor

@bkcsoft bkcsoft commented Sep 8, 2016

This implements Deletion of Issue-comments and Listing all issue-comments in a Repo
https://developer.github.com/v3/issues/comments/#delete-a-comment
https://developer.github.com/v3/issues/comments/#list-comments-in-a-repository

Edit: Closes #3673

See gogs/go-gogs-client#48

Adds 2 new Endpoints:

List all issue-comments for a given Repository

Issue Comments are ordered by ascending ID.

GET /repos/:username/:reponame/issues/comments
Parameters
Name Type Description
since string Only comments updated at or after this time are returned. This is a timestamp in RFC3339 format: 2006-01-02T15:04:05Z07:00
Response
Status: 200 OK
Content-Type: application/json
[
  {
    "id": 74,
    "user": {
      "id": 1,
      "username": "unknwon",
      "full_name": "无闻",
      "email": "u@gogs.io",
      "avatar_url": "http://localhost:3000/avatars/1"
    },
    "body": "what?",
    "created_at": "2016-08-26T11:58:18-07:00",
    "updated_at": "2016-08-26T11:58:18-07:00"
  }
]

Delete a Issue-comment

DELETE /repos/:username/:reponame/issues/:index/comments/:id

Response

Status: 204 No Content

m.Group("/:index", func() {
m.Combo("").Get(repo.GetIssue).Patch(bind(api.EditIssueOption{}), repo.EditIssue)

m.Group("/comments", func() {
m.Combo("").Get(repo.ListIssueComments).Post(bind(api.CreateIssueCommentOption{}), repo.CreateIssueComment)
m.Combo("/:id").Patch(bind(api.EditIssueCommentOption{}), repo.EditIssueComment)
m.Combo("/:id").Patch(bind(api.EditIssueCommentOption{}), repo.EditIssueComment).
Delete(repo.DeleteIssueComment)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These should probably be removed as they are redundant and non-compliant

@rymai
Copy link

rymai commented Dec 16, 2016

This would be great to have this ported to Gitea! :)

dbalexandre pushed a commit to gitlabhq/gitlabhq that referenced this pull request Dec 21, 2016
It adds a brand new importer for Gitea!

This is a continuation of !6945 started by @bkc.

Gitea aims to be 100% GitHub-compatible but there's a few differences:

- Gitea is not an OAuth provider (yet): go-gitea/gitea#27
  - This means we cannot map Gitea users given an assignee ID => assignees are not set on imported issues and merge requests
- No releases API for now: go-gitea/gitea#330
- API version is `v1` (GitHub is `v3`)
- The IID field for milestones is `id` compared to `number` in GitHub.
- Issues, PRs, milestones, labels don't have a `url` field (the importer now fallback to `''` in that case)

**Known issues:**

- Comments are not imported because comments JSON always have a blank `html_url`/`issue_url`/`pull_request_url`, so the IID cannot be extracted and the issuable cannot be found... :( This is tracked in go-gitea/gitea#401, and solved by gogs/gogs#3624 but this needs to be submitted / merged in Gitea.

This is noted in the documentation.

## Are there points in the code the reviewer needs to double check?

1. I've made `Import::GiteaController` inherit from `Import::GithubController` since both controllers should be identical in the long-term and their current differences are small.
1. I've added a base `IssuableFormatter` class from which `IssueFormatter` & `PullRequestFormatter` inherit
1. I've added shared examples for GitHub/Gitea importer classes
1. I've made `Gitlab::ImportSources` more robust and tested! 🎄 
1. I've added routing specs for import routes! 🎄 

Closes #22348

See merge request !8116
@unknwon
Copy link
Member

unknwon commented Dec 21, 2016

Thanks!

But can't see why #3673 relates to this?

@unknwon unknwon merged commit b2de3d7 into gogs:develop Dec 21, 2016
unknwon added a commit that referenced this pull request Dec 21, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants