duckduckgo / zeroclickinfo-spice

DuckDuckGo Instant Answers based on JavaScript (JSON) APIs
https://duckduckhack.com/
Other
548 stars 942 forks source link

IPLookup: "blacklist" isn't listed even though they're returned by the API #1116

Closed jagtalon closed 10 years ago

jagtalon commented 10 years ago

screen shot 2014-09-25 at 2 21 53 pm

mintsoft commented 10 years ago

@jagtalon I think this is actually the other way around; there are blacklists but they're not being rendered from the template

jagtalon commented 10 years ago

@mintsoft Oh thanks for that

mintsoft commented 10 years ago

@jagtalon @moollaza This is properly strange; I think there might be a problem with the handlebarsy thing: if I switch the template to this:

<div>
    {{#each famlist from="0" to="1"}}
        <h1 class='text--primary iplookup_domain_name zci__header--detail'><a href='http://{{this}}'>{{this}}</a></h1>
    {{/each}}
    <div class='text--primary iplookup_owner'>Owner: {{shortwho}}</div>
    <div class='text--secondary iplookup_location'>{{shortloc}}</div>
    {{#if blacklists}}
        <div class='text--secondary iplookup_blacklist'>Blacklists:
            {{#each blacklists}}
                <span>{{this}}</span>
            {{/each}}
        </div>
    {{/if}}
</div>

then it outputs;

The moment I use a div or switch the <span>{{this}}</span> to <li> it totally breaks the template

moollaza commented 10 years ago

@mintsoft I assume you added in the opening/closing ul tags too?

mintsoft commented 10 years ago

@moollaza yeah; it was valid markup (see : https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/share/spice/iplookup/content.handlebars#L9 )

mintsoft commented 10 years ago

@jagtalon @moollaza the plot thickens here, with this:

<div>
    {{#each famlist from="0" to="1"}}
        <h1 class='text--primary iplookup_domain_name zci__header--detail'><a href='http://{{this}}'>{{this}}</a></h1>
    {{/each}}
    <div class='text--primary iplookup_owner'>Owner: {{shortwho}}</div>
    <div class='text--secondary iplookup_location'>{{shortloc}}</div>
    {{#if blacklists}}
        <div class='text--secondary iplookup_blacklist'>
            {{#each blacklists}}
                <p>{{this}}</p>
            {{/each}}
        </div>
    {{/if}}
</div>

it only outputs the <h1><a>; no owner or anything. If you change the <p>{{this}}</p> to <span>{{this}}</span> the owner and location comes back o.0

Totally confused! I have no idea how to debug this further

tommytommytommy commented 10 years ago

@mintsoft Took a look at this tonight with @nathanntg; it seems that there's an ellipses function in the front end that is cutting off the extra lines without displaying the ellipses correctly. The handlebar functions seem to be working correctly, but the current HTML layout doesn't show any of the results because the first result begins on a new line. I tried to create a demo to show what's happening (https://github.com/tommytommytommy/zeroclickinfo-spice/blob/master/share/spice/iplookup/content.handlebars); in this version, one blacklist text is shown in full, and one blacklist text is partially displayed with appropriate ellipses:

screen shot 2014-10-01 at 12 08 53 am

I don't think that we can fix this from the back-end open source files?

mintsoft commented 10 years ago

@tommytommytommy Thanks for the input! That sort of tallies with what I've found, if it outputs on its own line then it just gets sort of ignored. @jagtalon @moollaza does that help at all?

mintsoft commented 10 years ago

@jagtalon @moollaza what are your thoughts about the best way to fix this? There are situations in-which there are many blacklists; it seems a bit odd that it only works properly if there's only one:

image

tommytommytommy commented 10 years ago

@mintsoft Here are two screenshots with 9 blacklists (not knowing any IPs on multiple blacklists, I just inserted the same entries into the JSON object) using the pull request at #1139. The ellipses appear correctly; it seems that the display problem has to do with results that are just a little, but not too, long?

screen shot 2014-10-03 at 10 58 45 am

screen shot 2014-10-03 at 10 58 58 am

mintsoft commented 10 years ago

@tommytommytommy Personally I would prefer a list over the long line, I'm sure we can fix whatever's up with it somehow

jagtalon commented 10 years ago

@mintsoft @tommytommytommy Oh, that's not good! So this looks like a bug. For the mean time, I think we should merge in https://github.com/duckduckgo/zeroclickinfo-spice/pull/1139 and we'll deal with the weird ellipsis function behavior internally.

Thanks!

mintsoft commented 10 years ago

@jagtalon do you want to raise an issue for the bug?

jagtalon commented 10 years ago

@mintsoft Made an internal issue for the bug since the info template isn't open source. Thanks, though!

jagtalon commented 10 years ago

Fixed by @tommytommytommy in #1142