-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix loading content history on show more #17819
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
Conversation
- Call `initRepoIssueContentHistory` so that the newly loaded issues also get their content history. - Resolves go-gitea#17767
Kind of unrelated but I don't like it that It might be better to do that fetch only when clicking the edit history, via a delegated event listener on a parent node. |
I think we should prevent As silverwind suggested, we may try to attach some event listeners to parent DOM node. ps: "something have been rendered directly into the HTML instead" seems more complex than this solution, it would break related code into many functions. Or, we can use a re-call safe function, eg: |
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.
I guess it's a good short-term fix.
Note that the ticket #17767 also mentions the scenario where a diff of a file is initially hidden because it is too large. |
So we'd need to add: diff --git a/web_src/js/features/repo-diff.js b/web_src/js/features/repo-diff.js
index 5f231b6c8..f8f6c38b7 100644
--- a/web_src/js/features/repo-diff.js
+++ b/web_src/js/features/repo-diff.js
@@ -127,6 +127,7 @@ export function initRepoDiffShowMore() {
}
$target.parent().replaceWith($(resp).find('#diff-file-boxes .diff-file-body .file-body').children());
+ initRepoIssueContentHistory();
}).fail(() => {
$target.removeClass('disabled');
});
if we wanted to catch the show diff too. I think however, we should consider if we want to load the history like this - would it be better to have it be dynamically loaded when the user requests to see the history? |
I think it's best if we add a attribute to a comment if it has history, and the front-end would request the history on demand. Any objections? |
No objections from me. This would simplify a lot of things and reduce the risk of serious problems with heavily edited issues and PRs. |
I think it can be done mostly in frontend, then we do not need to change backend code (no more dependencies or coupling, no need to make template files more complex)
|
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Andrew Thornton <[email protected]>
* Fix loading content history on show more - Call `initRepoIssueContentHistory` so that the newly loaded issues also get their content history. - Resolves go-gitea#17767 * apply history to show diff too Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: zeripath <[email protected]> Co-authored-by: 6543 <[email protected]>
initRepoIssueContentHistory
so that the newly loaded comments also get their content history.