Skip to content

Bug delete user #398 #236

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

Merged
merged 1 commit into from
Nov 3, 2014
Merged

Bug delete user #398 #236

merged 1 commit into from
Nov 3, 2014

Conversation

YaroSpace
Copy link
Contributor

Bounty: BUG: After deleting a user/protip Coderwall will generate a 404 on the logged in home

Simple fix, but took ages to figure out.

For some reason (please somebody tell me why) has_many :protips, dependent: delete_all deletes all protips associated with a user, but does not trigger after_destroy or any other callbacks of Protip.
(hence does not update the ES index, deleted Protip's ids get returned in search results....eventually that causes ActiveRecord::NoRecordFound and 404)

I have tried dependent: :destroy, destroy_all - no effect, so just added a before_destroy callback for the User model.

@YaroSpace YaroSpace changed the title Bug delete user #398 [WIP] Bug delete user #398 Oct 27, 2014
@just3ws
Copy link
Contributor

just3ws commented Oct 28, 2014

ossum.

has_many :likes
has_many :comments, dependent: :delete_all

has_one :github_profile , class_name: 'Users::Github::Profile', dependent: :destroy
has_many :github_repositories, through: :github_profile , source: :repositories

after_validation :geocode_location, if: :location_changed? unless Rails.env.test?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my experience it can lead to a hard debuggable issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fine he just moved it from below. we should however remove it.
@YaroSpace , could you add a comment on top of that line # FIXME: Move to background job

@YaroSpace YaroSpace changed the title [WIP] Bug delete user #398 Bug delete user #398 Oct 30, 2014
@@ -31,5 +33,9 @@ def create_team(name = 'TEST_TEAM')
fill_in 'team_name', with: name
click_button 'Next'
end

def save_screenshot(path = 'tmp/screenshot.png', selector = 'body')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you extract such helper? Doesn't save_screenshot work already?

Documentation states that it is declared on Session and therefore seems to be available. Did you encounter any issue using it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

save_screenshot is capybara's internal command, it saves the screenshot/page without any assets, i.e images. The helper save_screenshot is using Proltergeist's internal command, which makes a proper screenshot from within the browser. However, the choice of the method name was silly, as it overrides the original command. Will fix that. Thanks.

just3ws added a commit that referenced this pull request Nov 3, 2014
@just3ws just3ws merged commit 23b29a0 into coderwall:master Nov 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants