Deleting an invited member causes 500 error
Summary
Deleting an invited member causes 500 error
Steps to reproduce
- Create a new project
- Add a project member that currently doesn't exist on the instance by email
- e.g. "joe.bloggs+test@example.com"
- Reload the members page
- Delete the invited member
What is the current bug behavior?
500 error
NoMethodError: undefined method `id' for nil:NilClass
from app/models/merge_request.rb:126:in `block in <class:MergeRequest>'
from active_record/scoping/named.rb:155:in `block (2 levels) in scope'
from active_record/relation.rb:302:in `scoping'
from active_record/scoping/named.rb:155:in `block in scope'
from active_record/relation/delegation.rb:94:in `public_send'
from active_record/relation/delegation.rb:94:in `block in method_missing'
from active_record/relation.rb:302:in `scoping'
from active_record/relation/delegation.rb:94:in `method_missing'
from app/services/members/authorized_destroy_service.rb:50:in `unassign_issues_and_merge_requests'
from lib/gitlab/metrics/instrumentation.rb:156:in `block in unassign_issues_and_merge_requests'
from lib/gitlab/metrics/method_call.rb:23:in `measure'
from lib/gitlab/metrics/instrumentation.rb:156:in `unassign_issues_and_merge_requests'
from app/services/members/authorized_destroy_service.rb:13:in `block in execute'
from active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
from active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
from active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
from lib/gitlab/database/load_balancing/connection_proxy.rb:75:in `block in write_using_load_balancer'
from lib/gitlab/database/load_balancing/load_balancer.rb:66:in `block in read_write'
from lib/gitlab/database/load_balancing/load_balancer.rb:116:in `retry_with_backoff'
from lib/gitlab/database/load_balancing/load_balancer.rb:65:in `read_write'
from lib/gitlab/database/load_balancing/connection_proxy.rb:69:in `write_using_load_balancer'
from lib/gitlab/database/load_balancing/connection_proxy.rb:43:in `block (2 levels) in <class:ConnectionProxy>'
from active_record/transactions.rb:220:in `transaction'
from app/services/members/authorized_destroy_service.rb:12:in `execute'
from lib/gitlab/metrics/instrumentation.rb:156:in `block in execute'
from lib/gitlab/metrics/method_call.rb:23:in `measure'
from lib/gitlab/metrics/instrumentation.rb:156:in `execute'
from app/services/members/destroy_service.rb:22:in `execute'
What is the expected correct behavior?
Invited user is deleted
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Results of GitLab application Check
Additional details
Sentry entry:
/cc @vsizov