Template update not loading and failing resources


(Nicklas Møller) #1

Hello,

I’ve got at template update on https://forum.billysbilling.dk/ that just over the night stopped working. Unfortunately, also our logo started to disappear on some requests (403 Forbidden response)

The layout update is taken from Discourse Meta where I’ve made some smaller adjustments, to fit it to our needs.

</body>

<script type='text/x-handlebars' data-template-name='list/topic_list_item.raw'>

  <td class='main-link clearfix'>
    {{raw "topic-status" topic=topic}}
    {{topic-link topic}}

    {{#if controller.showTopicPostBadges}}
      {{raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl}}
    {{/if}}

    {{raw "list/topic-excerpt" topic=model}}

    <div class='creator'>
        {{~#if topic.creator ~}}
            <a href="/users/{{topic.creator.username}}" data-auto-route="true" data-user-card="{{topic.creator.username}}">{{topic.creator.username}}</a>
            &nbsp;
            {{format-date topic.createdAt format="medium-with-ago"}}
        {{~/if ~}}
        
        {{raw "list/action-list" topic=topic postNumbers=topic.bookmarked_post_numbers className="bookmarks" icon="bookmark"}}
        {{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
    </div>
  </td>

  {{#if controller.showLikes}}
    <td class="num likes">
      {{number topic.like_count}} <i class='fa fa-heart'></i>
    </td>
  {{/if}}

  {{#if controller.showOpLikes}}
    <td class="num likes">
      {{number topic.op_like_count}} <i class='fa fa-heart'></i>
    </td>
  {{/if}}
  
  <td class="category">
    {{category-link topic.category showParent="true" onlyStripe="true"}}
  </td>

  <td class="num views">
    {{topic.views}}
  </td>

  <td class="num views">
    {{topic.replyCount}}
  </td>

  <td class="last-post">
    <div class='poster-avatar'>
      <a href="{{topic.lastPostUr}}" data-user-card="{{topic.last_poster_username}}">{{avatar topic.lastPoster usernamePath="username" imageSize="medium"}}</a>
    </div>

    <div class='poster-info'>
      <a href="{{topic.lastPostUrl}}">
        {{format-date topic.bumpedAt format="medium-with-ago"}},
      </a><br />
      <span class='editor'><a href="/users/{{topic.last_poster_username}}" data-auto-route="true" data-user-card="{{topic.last_poster_username}}">{{topic.last_poster_username}}</a></span>
    </div>
  </td>
</script>

<script type='text/x-handlebars' data-template-name='topic-list-header.raw'>
  {{raw "topic-list-header-column" order='posts' name='topic.title'}}

  {{#if showLikes}}
    {{raw "topic-list-header-column" sortable='true' order='likes' number='true' forceName='Likes'}}
  {{/if}}

  {{#if showOpLikes}}
    {{raw "topic-list-header-column" sortable='true' order='op_likes' number='true' forceName='Likes'}}
  {{/if}}
  
  {{raw "topic-list-header-column" sortable='true' order='category' forceName='Kategori'}}
  {{raw "topic-list-header-column" sortable='true' number='true' order='views' forceName='Visninger'}}
  {{raw "topic-list-header-column" sortable='true' number='true' order='posts' forceName='Svar'}}
  {{raw "topic-list-header-column" sortable='true' order='activity' forceName='Sidste indlæg'}}
</script>

<script>
  Discourse.TopicListItemView.reopen({
    showCategory: function(){
      return !this.get('controller.hideCategory') &&
        this.get('topic.creator') &&
        this.get('topic.category.name') !== 'uncategorized';
    }.property()
  });

  Discourse.Topic.reopen({
    creator: function(){
      var poster = this.get('posters.firstObject');
      if(poster){
        return poster.user;
      }
    }.property(),
    lastPoster: function() {
      var poster = this.get('posters.lastObject');
      if(poster){
        if (this.last_poster_username === poster.user.username){
          return poster.user;
        } else {
          return this.get('creator');
        }
      }
    }.property('posters'),
    replyCount: function(){
      return this.get('posts_count') - 1;
    }.property(),
    hasReplies: function(){
      return this.get('posts_count') > 1;
    }.property()

  });
</script>

CSS

.poster-avatar {
    float: left;
}

.poster-info {
    float: left;
    margin-left: 10px;
}

@media (max-width: 760px) {
    .poster-avatar {
        display: none;
    }
}

@media (max-width: 560px) {
    .topic-list .category {
        display:none;
    }
}

.topic-list .posts {
    width: 640px;
}

.topic-list .num {
    width: 65px;
}

.topic-list .activity {
    width: 180px !important;
}

.category .badge-wrapper {
    line-height: 1.6;
}

.category .badge-category-bg {
    border-radius: 3px;
    line-height: 2.5;
}

.category .badge-category {
    padding: 10px 20px;
}

.category .badge-category-parent-bg {
    border-radius: 3px;
}

.creator .relative-date {
    text-transform: capitalize;
}

Unfortunately, this isn’t the first time we’ve had some loading issues (just a guess for the cause), as a hosted Discourse solution. CDN 503 on user avatars and CSS files

Anyone able to help me out here? @sam or @codinghorror eventually?


(Régis Hanol) #2

I’m afraid the ember update might have broken the template. I’ve disabled it until we fix it. cc @eviltrout

That’s because the URL it points to is returning 403

→ curl -I https://billysbilling.dk/sites/default/files/public/styles/media_thumbnail/public/billys-forum_0.png
HTTP/1.1 403 Forbidden
Content-Type: text/html; charset=iso-8859-1
Date: Tue, 12 May 2015 11:11:11 GMT
Server: Apache/2.2.29 (Amazon)
Connection: keep-alive

Might want to take a look at your configuration.


(Nicklas Møller) #3

Just to be sure - you’ve disabled our template until it’s fixed (it’s indeed disabled now)? Could it be possible that you can notice me when it’s fixed?

I see that that’s the case (didn’t care to see where our logo was fetched from). It’s on our part, but it seems to be halting. Thanks though :slight_smile:


(Sam Saffron) #4

I think changing topic_list_item to topic-list-item should fix it


(Nicklas Møller) #5

It’s not working, if you’re meaning on our end - although your suggestion is reasonable, the template is still not updated, whether using underscores or dashes


(JT) #6

I had the same issue and that fixed it for me, thanks!


(Nicklas Møller) #7

And same for me - it appeared my last attempt didn’t save the changes I made. Thanks for contributing, also - and thanks for the solution @sam :smile:


(Régis Hanol) #8