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

Rails backtrace: TypeError in Posts#show #278

Closed
tripleee opened this issue Nov 3, 2017 · 5 comments
Closed

Rails backtrace: TypeError in Posts#show #278

tripleee opened this issue Nov 3, 2017 · 5 comments

Comments

@tripleee
Copy link
Member

tripleee commented Nov 3, 2017

https://metasmoke.erwaysoftware.com/post/515 gives me a backtrace:

Showing /var/railsapps/metasmoke/releases/20171102150746/app/views/posts/show.html.erb where line #90 raised:

can't convert nil into an exact number

Extracted source (around line #90):

<% end %>

<% if user_signed_in? && current_user.api_token.present? && !@post.is_fp && !@post.is_deleted? && Time.now - @post.created_at <= 1.hour %>
 <p>

@tripleee
Copy link
Member Author

tripleee commented Nov 3, 2017

Spot checks and a bit of bisection suggests all the oldest posts up through 660 have this.

@j-f1
Copy link
Contributor

j-f1 commented Nov 3, 2017

Additionally, fetching it from the API fails with undefined method site_domain' for nil:NilClass`:

  def fetch_revision_count(post = nil)
    post ||= self
    # ⬇️ this line here
    params = "key=#{AppConfig['stack_exchange']['key']}&site=#{post.site.site_domain}&filter=!mggE4ZSiE7"

    url = "https://api.stackexchange.com/2.2/posts/#{post.stack_id}/revisions?#{params}"
    revision_list = JSON.parse(Net::HTTP.get_response(URI.parse(url)).body)['items']

@ArtOfCode-
Copy link
Member

We don't have the information we need to find out which sites these old posts were from; unless anyone can think of some way to do that, I'm gonna close this.

@Undo1
Copy link
Member

Undo1 commented Dec 30, 2017

Reopening - we can't see what site it's from, but the display page should probably handle that case properly. Unless we want to call it wontfix on the display side, which... I wouldn't be opposed to.

@Undo1 Undo1 reopened this Dec 30, 2017
@ArtOfCode-
Copy link
Member

That we can do :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants