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

Add 'mark thread as done' functionality #3265

Merged
merged 3 commits into from
Sep 17, 2024
Merged

Conversation

danhcole
Copy link
Contributor

Fixes #3264.

Copy link

codecov bot commented Sep 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.94%. Comparing base (2b8c7fa) to head (e0c8cdf).
Report is 112 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3265      +/-   ##
==========================================
- Coverage   97.72%   92.94%   -4.78%     
==========================================
  Files         153      171      +18     
  Lines       13390    11669    -1721     
==========================================
- Hits        13085    10846    -2239     
- Misses        215      729     +514     
- Partials       90       94       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @danhcole !
One minor tweak, please, then we should be ready for a second LGTM+Approval from any other contributor to this repo before merging.

// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-done
//
//meta:operation DELETE /notifications/threads/{thread_id}
func (s *ActivityService) MarkThreadDone(ctx context.Context, id string) (*Response, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

According to this: https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#mark-a-thread-as-done
id is an integer, so let's please change this:

Suggested change
func (s *ActivityService) MarkThreadDone(ctx context.Context, id string) (*Response, error) {
func (s *ActivityService) MarkThreadDone(ctx context.Context, id int64) (*Response, error) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me, I'll update the PR. The MarkThreadRead function (which I shamelessly copied from) has the same issue, would you like me to fix it as part of this PR, or put in a separate PR to keep things clean?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, a separate PR would be great since that will be a breaking change. Thank you!

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Sep 16, 2024
})

ctx := context.Background()
_, err := client.Activity.MarkThreadDone(ctx, "1")
Copy link
Collaborator

Choose a reason for hiding this comment

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

These strings will need to be changed to int64 for tests to pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whops, fixed and tests pass locally now.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @danhcole !
LGTM.

Awaiting second LGTM+Approval from any other contributor to this repo before merging.

Copy link
Contributor

@tomfeigin tomfeigin left a comment

Choose a reason for hiding this comment

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

LGTM

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Sep 17, 2024
@gmlewis
Copy link
Collaborator

gmlewis commented Sep 17, 2024

Thank you, @tomfeigin!
Merging.

@gmlewis gmlewis merged commit 057ff1b into google:master Sep 17, 2024
6 of 7 checks passed
rafaeldtinoco pushed a commit to rafaeldtinoco/go-github that referenced this pull request Sep 20, 2024
rafaeldtinoco pushed a commit to rafaeldtinoco/go-github that referenced this pull request Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Mark Thread As Done' is missing.
3 participants