Skip to content
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

Fix migration information update bug when linked github account #10310

Merged
merged 4 commits into from
Feb 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix bug on upgrade migrated reactions
  • Loading branch information
lunny committed Feb 17, 2020
commit 37af821944ea972a0176fadf1549db287e11e59f
5 changes: 2 additions & 3 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -1873,9 +1873,8 @@ func UpdateIssuesMigrationsByType(gitServiceType structs.GitServiceType, origina
// UpdateReactionsMigrationsByType updates all migrated repositories' reactions from gitServiceType to replace originalAuthorID to posterID
func UpdateReactionsMigrationsByType(gitServiceType structs.GitServiceType, originalAuthorID string, userID int64) error {
_, err := x.Table("reaction").
Join("INNER", "issue", "issue.id = reaction.issue_id").
Where("issue.repo_id IN (SELECT id FROM repository WHERE original_service_type = ?)", gitServiceType).
And("reaction.original_author_id = ?", originalAuthorID).
Where("original_author_id = ?", originalAuthorID).
And("issue_id IN (SELECT id FROM issue WHERE issue.repo_id IN (SELECT id FROM repository WHERE original_service_type = ?))", gitServiceType).
Update(map[string]interface{}{
"user_id": userID,
"original_author": "",
Expand Down