codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
385 stars 69 forks source link

Community list in page footer does not match Communities drop-down in header #1216

Open cellio opened 11 months ago

cellio commented 11 months ago

meta:288624

The newest community on our network, Proposals, is missing from the list of communities shown in the page footer, but is present in the communities drop-down widget in the header.

The footer HTML:

      <div class="grid--cell is-6 is-12-md is-12-sm">
        <h3>Other Codidact Communities</h3>
        <ul>
          <% Rails.cache.persistent('codidact_sites').each do |site| %>
            <li><%= link_to site['name'], site['canonical_url'] %></li>
          <% end %>
        </ul>
      </div>

I understand why we would want to cache that; otherwise every single page load would be affected. Is the cache stuck? I assume it could be manually flushed, but is there something we could do in our code to avoid the need for manual intervention?

(Aside: if someone's editing that anyway, can we change "Codidact" to "Network" in the heading, in keeping with other attempts to generalize strings in the code?)

The drop-down code, for reference, seems to compute the list dynamically. I assume that would be a terrible idea in the footer:

  <h3 class="h-m-t-1">Communities</h3>
  <div class="community-header-list">
    <% logo_paths = SiteSetting.all_communities('SiteLogoPath') %>
    <% Community.where(hidden: false).each do |c| %>
      <div class="community-header-list-entry">
        <% logo_setting = logo_paths[c.id] %>
        <%= link_to "//#{c.host}" do %>
          <% if logo_setting.present? %>
            <div class="img">
              <img src="<%= logo_setting %>" alt="<%= c.name %>" class="community-header-list-image">
            </div>
          <% end %>
          <div class="label">
            <%= c.name %>
          </div>
        <% end %>
      </div>
    <% end %>
  </div>