You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by "sy-records (via GitHub)" <gi...@apache.org> on 2024/12/18 10:34:45 UTC
[PR] feat: Add permanently delete [incubator-answer]
sy-records opened a new pull request, #1207:
URL: https://github.com/apache/incubator-answer/pull/1207
close #1205
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add permanently delete [incubator-answer]
Posted by "sy-records (via GitHub)" <gi...@apache.org>.
sy-records commented on PR #1207:
URL: https://github.com/apache/incubator-answer/pull/1207#issuecomment-2560896520
@LinkinStars Thank you for testing! ❤️
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add permanently delete [incubator-answer]
Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1207:
URL: https://github.com/apache/incubator-answer/pull/1207#issuecomment-2560885243
We are almost done. We have tested various scenarios of what might happen. So far, only the following two locations are potentially problematic.
### Add default Operator

```
runtime/panic.go:785 http: panic serving 127.0.0.1:57957: runtime error: invalid memory address or nil pointer dereference
goroutine 39 [running]:
net/http.(*conn).serve.func1()
go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.2.darwin-arm64/src/net/http/server.go:1947 +0x118
panic({0x107a03860?, 0x108dd5e50?})
go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.2.darwin-arm64/src/runtime/panic.go:785 +0xf0
github.com/apache/incubator-answer/internal/service/question_common.(*QuestionCommon).FormatQuestionsPage
```
We can try to add a default operator to solve it.
https://github.com/apache/incubator-answer/blob/f7731bc675930f9cb9fa7a6f6346c102246b2c4d/internal/service/question_common/question.go#L385
```go
Operator: &schema.QuestionPageRespOperator{ID: questionInfo.UserID},
```
### Checking the ActivityUser
```
http: panic serving 127.0.0.1:58701: runtime error: invalid memory address or nil pointer dereference
goroutine 777 [running]:
net/http.(*conn).serve.func1()
go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.2.darwin-arm64/src/net/http/server.go:1947 +0xb0
panic({0x102990920?, 0x103d85cb0?})
go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.2.darwin-arm64/src/runtime/panic.go:785 +0x124
github.com/apache/incubator-answer/internal/repo/activity.(*VoteRepo).setActivityRankToZeroIfUserReachLimit(
incubator-answer/internal/repo/activity/vote_repo.go:256
```
https://github.com/apache/incubator-answer/blob/f7731bc675930f9cb9fa7a6f6346c102246b2c4d/internal/repo/activity/vote_repo.go#L242
Maybe we can add a checking here, such like
```go
for _, activity := range op.Activities {
if userInfoMapping[activity.ActivityUserID] == nil {
continue
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add permanently delete [incubator-answer]
Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1207:
URL: https://github.com/apache/incubator-answer/pull/1207#issuecomment-2553193396
Thanks for your contributions.
This feat we need more time to test. For example, I tried permanently deleting users, without deleting content. It can lead to some unpredictable panic.
```
ERROR runtime/panic.go:785 http: panic serving 127.0.0.1:60872: runtime error: invalid memory address or nil pointer dereference
/incubator-answer/internal/service/question_common/question.go:451 +0xb88
github.com/apache/incubator-answer/internal/service/content.(*QuestionService).GetQuestionPage(0x14004ebdb00, {0x1066f3af0, 0x14008140a00}, 0x14007003698)
```
It turns out that some `Operator` and `Revision` queries may need to add some checks for permanently deleted users.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add permanently delete [incubator-answer]
Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai merged PR #1207:
URL: https://github.com/apache/incubator-answer/pull/1207
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add permanently delete [incubator-answer]
Posted by "sy-records (via GitHub)" <gi...@apache.org>.
sy-records commented on PR #1207:
URL: https://github.com/apache/incubator-answer/pull/1207#issuecomment-2553390968
@LinkinStars I have now added delete content after deleting users.
Do we still need to delete `Operator` and `Revision`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add permanently delete [incubator-answer]
Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1207:
URL: https://github.com/apache/incubator-answer/pull/1207#issuecomment-2553412561
> @LinkinStars I have now added delete content after deleting users.
>
> Do we still need to delete `Operator` and `Revision`?

If an administrator deletes a user by checking the box to also delete the content, then the related questions and answers should be deleted. If the administrator does not check this option, the related content will be retained.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org