-
-
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
Add comments to commit pages #32384
base: main
Are you sure you want to change the base?
Add comments to commit pages #32384
Conversation
Lint is failing due to the duplicate lines, though, due to the way I implemented this I think that would be hard to avoid. If anyone have an idea of what to do short of migrating issues itself to use conversations, please let me know |
Some comments are added for the whole commit, some are for special file and lines. Both kinds of comments are needed. |
Well, that's the problem .... Gitea is too big a project, it should keep the code maintainable and testable. If there are a lot of duplicate code and no test, it would break soon. The worse result is that nobody knows how to correctly maintain the code in the future, no bug could be fixed, no feature could be added, any change would introduce regressions ........ no end user likes regressions ..... 😅 |
I've ensure that everything functions properly now, and have also did some bare-bone unit tests. |
@@ -0,0 +1,222 @@ | |||
// Copyright 2024 The Gitea Authors. All rights reserved. |
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 don't know why we need indexer for commit comments. when and where will these indexers be used?
It's mostly copied over from issues that allow for searching the individual
comments. Was it not needed?
…On Sat, 9 Nov 2024, 02:03 Lunny Xiao, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In modules/indexer/conversations/bleve/bleve.go
<#32384 (comment)>:
> @@ -0,0 +1,222 @@
+// Copyright 2024 The Gitea Authors. All rights reserved.
I don't know why we need indexer for commit comments. when and where will
these indexers be used?
—
Reply to this email directly, view it on GitHub
<#32384 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI6CN52QAQ44RXUMNTTYAIDZ7T4FVAVCNFSM6AAAAABQ4KBBB2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDIMRUGU3TENBVHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
At least, there doesn’t seem to be a specific search requirement. |
Hmm, should I remove the indexer, for now?
…On Sat, 9 Nov 2024, 06:30 Lunny Xiao, ***@***.***> wrote:
It's mostly copied over from issues that allow for searching the
individual comments. Was it not needed?
… <#m_4111221246103194699_>
On Sat, 9 Nov 2024, 02:03 Lunny Xiao, *@*.*> wrote: @.** commented on
this pull request. ------------------------------ In
modules/indexer/conversations/bleve/bleve.go <#32384 (comment)
<#32384 (comment)>>: >
@@ -0,0 +1,222 @@ +// Copyright 2024 The Gitea Authors. All rights
reserved. I don't know why we need indexer for commit comments. when and
where will these indexers be used? — Reply to this email directly, view it
on GitHub <#32384 (review)
<#32384 (review)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AI6CN52QAQ44RXUMNTTYAIDZ7T4FVAVCNFSM6AAAAABQ4KBBB2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDIMRUGU3TENBVHA
. You are receiving this because you authored the thread.Message ID: *@*
.***>
At least, there doesn’t seem to be a specific search requirement.
—
Reply to this email directly, view it on GitHub
<#32384 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI6CN57V4Z6KKZKS7OYPCK3Z7U3RPAVCNFSM6AAAAABQ4KBBB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRVHA2DSNZUGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I think yes. Those could be considered in other PRs. |
I've removed files related to indexer now |
Can anyone check on this and let me know if there's anything I need to work on |
What is confusing to me is the following: While this leads to a bit more table joining, it is probably the only way forward to improve the Gitea commenting system: That way, it would be rather easy to additionally support (Team) Discussions or threads, features requests with quite some demand (i.e. #14562, #17858, and probably others I didn't find). |
That is... exactly what I'm doing. It is a duplication right now as I do not want to rewrite issues/pr to use this new conversation because it is outside of the scope of this PR. It is Issue's conversation that should've been separated in the first place, and that is what I did with mine. My current conversation is exactly written in a way to support pointing to other places in the future. Part of this effort, for instance, is that right now there is a field on conversation for ConversationType that is mostly unused but could be expanded on in the future to accommodate more types of conversations |
const ( | ||
CommentTypeComment CommentType = iota // 0 Plain comment, can be associated with a commit (CommitID > 0) and a line (LineNum > 0) | ||
|
||
CommentTypeLock // 1 Lock an conversation, giving only collaborators access |
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.
Why we have these types?
// Conversation represents a conversation. | ||
type Conversation struct { | ||
ID int64 `xorm:"pk autoincr"` | ||
Index int64 `xorm:"UNIQUE(repo_index)"` |
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.
Is it necessary to have a index?
What are all these types
They are for future expandability. My current implement lacks a way to lock
a conversation (though I've prepared the skeleton for that). In the future
as well, when we do migrate issues/pr to use this generic version of
conversation, the other types will be carried over
Is it necessary to have the index
Probably not right now? But it is there to keep track of the index of the
conversation inside of a repo for the future.
I also don't remember exactly and I might be mistaken but I think the index
is used in routing, i.e. <URL>/user/repo/conversation/<index>.
…On Fri, 29 Nov 2024, 02:51 Lunny Xiao, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In models/conversations/conversation.go
<#32384 (comment)>:
> +
+var ErrConversationAlreadyChanged = util.NewInvalidArgumentErrorf("the conversation is already changed")
+
+type ConversationType int
+
+// CommentTypeUndefined is used to search for comments of any type
+const ConversationTypeUndefined CommentType = -1
+
+const (
+ ConversationTypeCommit ConversationType = iota
+)
+
+// Conversation represents a conversation.
+type Conversation struct {
+ ID int64 `xorm:"pk autoincr"`
+ Index int64 `xorm:"UNIQUE(repo_index)"`
Is it necessary to have a index?
—
Reply to this email directly, view it on GitHub
<#32384 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI6CN53JMSX5SXJWDYCD2BT2C5QZXAVCNFSM6AAAAABQ4KBBB2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDINRYG4YTSNZZG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This PR aims to add comments to the commit page (/reponame/username/commit/{id})
Implementation:
Screenshots of implementation:
Desktop
Mobile
Please do give me feedback in any to get this PR approved.
/claim #4898