Allow full links for cache buster tool (#3378)

This commit is contained in:
Andy Zhao 2019-07-03 10:32:27 -04:00 committed by Mac Siri
parent 04ce7738ab
commit 2b5a1c83a2
3 changed files with 9 additions and 7 deletions

View file

@ -29,6 +29,7 @@ class Internal::ToolsController < Internal::ApplicationController
def bust_link(link)
cb = CacheBuster.new
link.sub!("https://dev.to", "") if link.starts_with?("https://dev.to")
cb.bust(link)
cb.bust(link + "/")
cb.bust(link + "?i=i")

View file

@ -1,22 +1,23 @@
<h1>General Purpose Fastly Purge</h1>
<p>For a page that should 404:</p>
<h1>General Purpose URL Purge</h1>
<p>For a page that should 404. This will purge the page via Fastly.</p>
<p>Use the full path (https://dev.to/xyz) or the relative path: (/xyz)</p>
<%= form_tag "/internal/tools/bust_cache" do %>
<%= label_tag("Relative Link:") %>
<%= label_tag("Link:") %>
<%= text_field_tag :dead_link, nil, placeholder: "/devteam/page" %>
<%= submit_tag("Clear Cache") %>
<% end %>
<hr>
<h1>Bust Cache For Specific Content</h1>
<p>This clears the rails cache & the fastly cache.</p>
<p>This clears both the Rails cache & the Fastly cache.</p>
<%= form_tag "/internal/tools/bust_cache" do %>
<%= label_tag("Article id: ") %>
<%= label_tag("Article ID: ") %>
<%= text_field_tag :bust_article, nil, placeholder: "12345" %>
<%= submit_tag("Clear Cache") %>
<% end %>
<br>
<%= form_tag "/internal/tools/bust_cache" do %>
<%= label_tag("User id: ") %>
<%= label_tag("User ID: ") %>
<%= text_field_tag :bust_user, nil, placeholder: "12345" %>
<%= submit_tag("Clear Cache") %>
<% end %>

View file

@ -123,7 +123,7 @@
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<% controller_names = %w[comments articles users members dogfood tags welcome broadcasts reports pages classified_listings] %>
<% controller_names = %w[comments articles users members dogfood tags welcome broadcasts reports pages classified_listings tools] %>
<% controller_names.each do |name| %>
<li class="<%= "active" if controller_name == name %>"><a href="/internal/<%= name %>"><%= name %></a></li>
<% end %>