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

recover gracefully when admin views deleted project #26693

Merged
merged 1 commit into from Jan 23, 2019

Conversation

davidsbailey
Copy link
Member

@davidsbailey davidsbailey commented Jan 22, 2019

Background

https://app.honeybadger.io/projects/3240/faults/44663286 indicates that admins are getting 500 when following urls to deleted projects. This is because the admin panel displays content moderation info

- storage_apps = StorageApps.new(storage_id('user'))
- content_moderation_disabled = storage_apps.content_moderation_disabled?(params[:channel_id])
%li
and the content moderation logic raises if you check whether a deleted project requires moderation:
def content_moderation_disabled?(channel_id)
_owner, storage_app_id = storage_decrypt_channel_id(channel_id)
row = @table.where(id: storage_app_id).exclude(state: 'deleted').first
raise NotFound, "channel `#{channel_id}` not found" unless row

Description

The solution is to not raise for deleted projects. In the admin panel this suppresses any errors long enough for the page to redirect. This is also harmless for non-admins in production, since an earlier lookup to the project would 404 prior to any 404 being generated by the line modified in this PR:

project_type = storage_apps.project_type_from_channel_id(encrypted_channel_id)

Testing

Manually verified that when an admin views a deleted project, they now get redirected to their latest project of that type instead of seeing a 500 error.

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

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

Thanks for this fix Dave! Looks great, very clear reasoning on the solution.

@davidsbailey davidsbailey merged commit c337808 into staging Jan 23, 2019
@davidsbailey davidsbailey deleted the moderate-deleted-project branch January 23, 2019 00:40
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.

None yet

2 participants