-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Change ID pattern of raw content container for issue #21966
Conversation
Codecov Report
@@ Coverage Diff @@
## main #21966 +/- ##
=======================================
Coverage ? 48.14%
=======================================
Files ? 1037
Lines ? 141357
Branches ? 0
=======================================
Hits ? 68052
Misses ? 65165
Partials ? 8140 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Something is wrong here, you seem to have commited a |
a609a70
to
bdaa75e
Compare
Excuse me. You are right. I think it's ready now. |
Thanks for reviewing @silverwind. |
Are you sure this won't break any |
bdaa75e
to
a2f6f6b
Compare
Ok. I finally understand how things work for quotes. I hope the fix is correct this time. |
So the problem here is that people may have written links in their comments looking to link to commit-$COMMENT_ID and these will now break. Is it really necessary to add the |
I don't understand the original issue but I think if we change all the |
The proposed ID change is for the raw content inside issues and comments (required for quoting before doing post), not for the issue ID itself nor the comment ID itself. Those IDs (for linking) remain intact in the templates in the |
The problem is a collision between html IDs of raw-content of an issue and a single one of its comments, because their current html ID prefix (comment-) is the same for both. So, taking into account the fact that is possible that equals internal ID (one from the issue and the other from any of its comments) appears in the same page, the unwanted behaviour is that quoting to reply or quoting for a new issue with a reference, takes a quoted text that belongs to the other object (issue or comment, respectively). |
… avoid internal ID collisions. Fixes go-gitea#21965.
a2f6f6b
to
46cbba0
Compare
I updated the commit:
|
@@ -54,7 +54,7 @@ | |||
<span class="no-content">{{$.root.locale.Tr "repo.issues.no_content"}}</span> | |||
{{end}} | |||
</div> | |||
<div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div> | |||
<div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could .HashTag
be used here instead of .ID
?
The problem of using "issuecomment-{{.ID}}-raw"
here is: it introduces inconsistency, future developers won't understand easily that data-target="{{.item.HashTag}}-raw"
means something like "issuecomment-{{.ID}}-raw"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be, but the line immediately following has a data-write="issuecomment-{{.ID}}-write"
attribute (which I think will also leave an inconsistency) and, on the other hand, the data-target="{{.item.HashTag}}-raw"
attribute means either "issuecomment-{.ID}}-raw"
or "issue-{.ID}}-raw"
depending on the context.
Update: Maybe another PR could change all the "issuecomment-{.ID}}-suffix"
as "{{.HashTag}}-suffix"
of the template for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yup, it was messy already. 😂 It could LGTM.
These IDs are for "hidden" texts (to be quoted later), it won't break anything IMO. |
* giteaofficial/main: Use multi reader instead to concat strings (go-gitea#22099) Fix sorting admin user list by last login (go-gitea#22081) Fix wrong default value for update checker on app.example.ini (go-gitea#22084) fix(config): remove context on config template (go-gitea#22096) [skip ci] Updated licenses and gitignores Update xorm (go-gitea#22094) Remove unnecessary whitespace in snapcraft.yaml (go-gitea#22090) Rename almost all Ctx functions (go-gitea#22071) Change ID pattern of raw content container for issue (go-gitea#21966) Optimize html templates (go-gitea#22080) Add API management for issue/pull and comment attachments (go-gitea#21783) Rename actions to operations on UI (go-gitea#22067) Update go dev dependencies (go-gitea#22064)
Implement differentiation to html id for issue raw content container.
Fixes #21965