mirror of https://github.com/go-gitea/gitea
Add OriginalID to comments
This commit is contained in:
parent
6e3b98051b
commit
186a9a932f
|
@ -225,6 +225,7 @@ type Comment struct {
|
|||
Poster *user_model.User `xorm:"-"`
|
||||
OriginalAuthor string
|
||||
OriginalAuthorID int64
|
||||
OriginalID int64 // Only used in synced comments
|
||||
IssueID int64 `xorm:"INDEX"`
|
||||
Issue *Issue `xorm:"-"`
|
||||
LabelID int64
|
||||
|
|
|
@ -328,7 +328,7 @@ func UpsertIssueComments(comments []*issues_model.Comment) error {
|
|||
}
|
||||
} else {
|
||||
if _, err := sess.NoAutoTime().Where(
|
||||
"issue_id = ? AND created_unix = ?", comment.IssueID, comment.CreatedUnix,
|
||||
"issue_id = ? AND original_id = ?", comment.IssueID, comment.OriginalID,
|
||||
).Update(comment); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ type Comment struct {
|
|||
Content string
|
||||
Reactions []*Reaction
|
||||
Meta map[string]interface{} `yaml:"meta,omitempty"` // see models/issues/comment.go for fields in Comment struct
|
||||
OriginalID int64 `yaml:"-"` // ID from the upstream syncing source
|
||||
}
|
||||
|
||||
// GetExternalName ExternalUserMigrated interface
|
||||
|
|
|
@ -506,6 +506,7 @@ func (g *GiteaLocalUploader) prepareComments(comments ...*base.Comment) ([]*issu
|
|||
Content: comment.Content,
|
||||
CreatedUnix: timeutil.TimeStamp(comment.Created.Unix()),
|
||||
UpdatedUnix: timeutil.TimeStamp(comment.Updated.Unix()),
|
||||
OriginalID: comment.OriginalID,
|
||||
}
|
||||
|
||||
switch cm.Type {
|
||||
|
|
|
@ -490,6 +490,7 @@ func (g *GithubDownloaderV3) getCommentsSince(commentable base.Commentable, sinc
|
|||
Created: comment.GetCreatedAt().Time,
|
||||
Updated: comment.GetUpdatedAt().Time,
|
||||
Reactions: reactions,
|
||||
OriginalID: comment.GetID(),
|
||||
})
|
||||
}
|
||||
if resp.NextPage == 0 {
|
||||
|
|
Loading…
Reference in New Issue