Link to code comment in mails is wrong on single comment #2925

Closed
opened 2025-11-02 04:54:19 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @markusamshove on GitHub (Feb 16, 2019).

When leaving just one comment on a pull request, a notification mail gets sent.

However, the single comment doesn't show up in the conversation view of the PR (is this expected for non-review-comments?), which leads to a wrong link.
The correct link for the single comment would have /files/ in there to switch to the files view and therefore be able to place the view on the correct comment anchor.

This seems to be the appropriate place to put the /files/ into the link depending on the CommentType.

I've tried

        if comment != nil {
-               data = composeTplData(subject, body, issue.HTMLURL()+"#"+comment.HashTag())
+               if comment.Type == CommentTypeCode {
+                       data = composeTplData(subject, body, issue.HTMLURL()+"/files/#"+comment.HashTag())
+               } else {
+                       data = composeTplData(subject, body, issue.HTMLURL()+"#"+comment.HashTag())
+               }
        } else {
                data = composeTplData(subject, body, issue.HTMLURL())
        }

but I'm sadly not able to test it locally, because I'm having a hard time setting up mail in the docker instance.

Originally created by @markusamshove on GitHub (Feb 16, 2019). When leaving just one comment on a pull request, a notification mail gets sent. However, the single comment doesn't show up in the conversation view of the PR (is this expected for non-review-comments?), which leads to a wrong link. The correct link for the single comment would have `/files/` in there to switch to the files view and therefore be able to place the view on the correct comment anchor. [This](https://github.com/go-gitea/gitea/blob/8c8ac1a16260c075e854bd370812284e0121613e/models/mail.go#L159) seems to be the appropriate place to put the `/files/` into the link depending on the `CommentType`. I've tried ``` if comment != nil { - data = composeTplData(subject, body, issue.HTMLURL()+"#"+comment.HashTag()) + if comment.Type == CommentTypeCode { + data = composeTplData(subject, body, issue.HTMLURL()+"/files/#"+comment.HashTag()) + } else { + data = composeTplData(subject, body, issue.HTMLURL()+"#"+comment.HashTag()) + } } else { data = composeTplData(subject, body, issue.HTMLURL()) } ``` but I'm sadly not able to test it locally, because I'm having a hard time setting up mail in the docker instance.
Author
Owner

@lafriks commented on GitHub (Feb 16, 2019):

I think problem is that single comment does not shows up in conversation tab but it should

@lafriks commented on GitHub (Feb 16, 2019): I think problem is that single comment does not shows up in conversation tab but it should
Author
Owner

@markusamshove commented on GitHub (Feb 16, 2019):

Okay, I was wondering if that was the case.
I agree that it should show in the conversations list.

Do we keep this issue or close it in favour of one targeting specific the conversations list?

@markusamshove commented on GitHub (Feb 16, 2019): Okay, I was wondering if that was the case. I agree that it should show in the conversations list. Do we keep this issue or close it in favour of one targeting specific the conversations list?
Author
Owner

@markusamshove commented on GitHub (Feb 18, 2019):

Closed in favor of #6110

@markusamshove commented on GitHub (Feb 18, 2019): Closed in favor of #6110
Author
Owner

@zeripath commented on GitHub (Feb 18, 2019):

Markus you should be able to set the mailer to dummy in order to see what would be mailed.

@zeripath commented on GitHub (Feb 18, 2019): Markus you should be able to set the mailer to dummy in order to see what would be mailed.
Author
Owner

@markusamshove commented on GitHub (Feb 18, 2019):

Thanks, I'll keep that in mind for the future.
For this one, I think lafriks confirmed that it is a bug, so the problem doesn't sit in mailing :-)

@markusamshove commented on GitHub (Feb 18, 2019): Thanks, I'll keep that in mind for the future. For this one, I think lafriks confirmed that it is a bug, so the problem doesn't sit in mailing :-)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2925