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

Do not add duplicate comments #19

Closed
ingwarsw opened this issue Jun 30, 2014 · 7 comments
Closed

Do not add duplicate comments #19

ingwarsw opened this issue Jun 30, 2014 · 7 comments

Comments

@ingwarsw
Copy link
Contributor

When doing review again (eg. on reopening PR) do not add duplicate reviews (same comment on same line)

Its surly possible on Stash.
Im not sure if its possible (or needed) on Gerrit.

@zygm0nt
Copy link
Collaborator

zygm0nt commented Jun 30, 2014

This seems a broken behavior - there should be already check for this situation.

I'll test that tomorrow.

@ingwarsw
Copy link
Contributor Author

Cool..

@zygm0nt
Copy link
Collaborator

zygm0nt commented Jul 2, 2014

Hi, haven't time yesterday, sorry.

I've checked that today, and this is not working (actually not implemented correctly).

I'm preparing a patch right now.

@zygm0nt
Copy link
Collaborator

zygm0nt commented Jul 2, 2014

Ok, I see why this is not added yet - I don't see how to map stash line comments to their respective lines.

Calling /rest/api/1.0/projects/%s/repos/%s/pull-requests/%s/diff with parameter withComments=true will return sth like this:

        "lineComments": [
            {
                "id": 43315,
                "version": 0,
                "text": "[Scalastyle] ERROR: Magic Number",
                "author": {
                    "name": "user",
                    "emailAddress": "email",
                    "id": 11594,
                    "displayName": "Me",
                    "active": true,
                    "slug": "user"
                },
                "createdDate": 1404278658000,
                "updatedDate": 1404278658000,
                "comments": [],
                "permittedOperations": {
                    "deletable": true,
                    "editable": true
                }
            },           
        ]

Which does not point to the line where the comment is attached. Will ask on attlassian mail list.

And question url for tracking: https://answers.atlassian.com/questions/311655/how-to-match-pull-request-comment-to-specific-line#

@ingwarsw
Copy link
Contributor Author

ingwarsw commented Jul 2, 2014

The "not so ideal" workaround to this issue would be to add some kind of "crc" from line number and comment and add it to comment itself.

crc = (comment + line).hashCode();
commentWithCrc = comment + " [" + crc + "]";

And then check for commentWithCrc in comments..

Ugly but should work..
If hashcode is too long you can shorten it (eg % 1000) or/and hex it.

@zygm0nt
Copy link
Collaborator

zygm0nt commented Jul 2, 2014

Great idea. Will implement that if there is no way with API.

@zygm0nt
Copy link
Collaborator

zygm0nt commented Jul 2, 2014

There is no answer from Atlassian. I've implemented Your solution, but haven't tested it on live system. This will be done tomorrow.

If you have time - please test :)

@zygm0nt zygm0nt closed this as completed in f468b6d Jul 3, 2014
rufuslevi pushed a commit to rufuslevi/sputnik that referenced this issue Mar 12, 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

No branches or pull requests

2 participants