FIX: CodeFund is shutting down (#85)

FIX: CodeFund is shutting down (#85)

diff --git a/README.md b/README.md
index fb15a45..6d20dec 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,6 @@ This is the official Discourse advertising plugin.  It allows advertisements to 
 * [Google Adsense](http://www.google.com.au/adsense/start/why-adsense.html)
 * [Google Double Click for Publishers](https://www.google.com/dfp)
 * [Amazon Affiliates](http://affiliate-program.amazon.com) - Banner and Product Link Ads
-* [CodeFund](https://codefund.io) - Ethical Ad Platform for Developers
 * [Carbon Ads](https://www.carbonads.net/)
 * [AdButler](https://www.adbutler.com/)
 
@@ -80,7 +79,6 @@ the ad slots. The ads will start showing as soon as you add them to slots.
 <li>House Ads - if you want to create and serve ads from your Discourse instance.</li>
 <li>Adsense - if using Adsense as your advertisement platform.</li>
 <li>DFP - if using the DoubleClick for Publishers advertisement platform.</li>
-<li>CodeFund - if using the CodeFund ethical advertisement platform.</li>
 <li>Carbon Ads - if using the Carbon Ads advertisement platform.</li>
 <li>AdButler - if using the AdButler advertisement platform.</li>
 </ul>
@@ -107,10 +105,6 @@ Only for Product Link and Banner Ads.
 
 ![](https://www.dropbox.com/sc/l67fb5c3tl8bq3d/AAAAMmccMW3kkIeBR7cBdWoFa?dl=1)
 
-##### CodeFund Embed Tag to Discourse's Site Settings
-
-![CodeFund Instructions](https://s3-us-west-2.amazonaws.com/codesponsor/discourse-codefund-instructions.png)
-
 ##### Carbon Ads Script Tag to Discourse's Site Settings
 
 ![Carbon Ads](https://d11a6trkgmumsb.cloudfront.net/original/3X/3/a/3acc7488db2b53733cdd427d3cb1b76361c786e1.png)
diff --git a/assets/javascripts/discourse/components/ad-slot.js.es6 b/assets/javascripts/discourse/components/ad-slot.js.es6
index 741ce93..608d3e3 100644
--- a/assets/javascripts/discourse/components/ad-slot.js.es6
+++ b/assets/javascripts/discourse/components/ad-slot.js.es6
@@ -30,17 +30,6 @@ const adConfig = Ember.Object.create({
       "topic-above-suggested": "amazon_mobile_topic_above_suggested_src_code"
     }
   },
-  "codefund-ad": {
-    settingPrefix: "codefund",
-    enabledSetting: "codefund_property_id",
-    nthPost: "codefund_nth_post",
-    desktop: {
-      "topic-list-top": "codefund_top_of_topic_list_enabled",
-      "post-bottom": "codefund_below_post_enabled",
-      "topic-above-post-stream": "codefund_above_post_stream_enabled",
-      "topic-above-suggested": "codefund_above_suggested_enabled"
-    }
-  },
   "carbonads-ad": {
     settingPrefix: "carbonads",
     enabledSetting: "carbonads_serve_id",
diff --git a/assets/javascripts/discourse/components/codefund-ad.js.es6 b/assets/javascripts/discourse/components/codefund-ad.js.es6
deleted file mode 100644
index c480d37..0000000
--- a/assets/javascripts/discourse/components/codefund-ad.js.es6
+++ /dev/null
@@ -1,139 +0,0 @@
-import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component";
-import discourseComputed, { observes } from "discourse-common/utils/decorators";
-import { Promise } from "rsvp";
-
-let _loaded = false,
-  _promise = null;
-
-const propertyId = Discourse.SiteSettings.codefund_property_id;
-
-function loadCodeFund() {
-  if (_loaded) {
-    return Ember.RSVP.resolve();
-  }
-
-  if (_promise) {
-    return _promise;
-  }
-
-  const url = "https://codefund.io/properties/" + propertyId + "/funder.json";
-
-  _promise = new Promise(function(resolve, reject) {
-    let xhr = new XMLHttpRequest();
-
-    xhr.open("GET", url);
-    xhr.onreadystatechange = handler;
-    xhr.responseType = "json";
-    xhr.setRequestHeader("Accept", "application/json");
-    xhr.send();
-
-    function handler() {
-      if (this.readyState === this.DONE) {
-        _loaded = true;
-
-        if (this.status === 200) {
-          resolve(this.response);
-        } else {
-          reject(
-            new Error(
-              "getJSON: `" + url + "` failed with status: [" + this.status + "]"
-            )
-          );
-        }
-      }
-    }
-  });
-
-  return _promise;
-}
-
-export default AdComponent.extend({
-  classNameBindings: [":codefund-ad"],
-  propertyId: propertyId,
-  adRequested: false,
-  adDetails: {},
-
-  displayPostBottom: Ember.computed.equal("placement", "post-bottom"),
-  displayTopicAbovePostStream: Ember.computed.equal(
-    "placement",
-    "topic-above-post-stream"
-  ),
-  displayTopicAboveSuggested: Ember.computed.equal(
-    "placement",
-    "topic-above-suggested"
-  ),
-  displayTopicListTop: Ember.computed.equal("placement", "topic-list-top"),
-
-  _triggerAds() {
-    if (!propertyId) return;
-
-    this.set("adRequested", true);
-    loadCodeFund()
-      .then(data => {
-        _loaded = false;
-        _promise = null;
-        this.set("adDetails", data);
-        this.set("adRequested", false);
-      })
-      .catch(error => {
-        // eslint-disable-next-line no-console
-        console.log(error);
-      });
-  },
-
-  didInsertElement() {
-    this._super();
-
-    if (!this.get("showAd")) {
-      return;
-    }
-
-    if (this.get("listLoading")) {
-      return;
-    }
-
-    Ember.run.scheduleOnce("afterRender", this, this._triggerAds);
-  },
-
-  @observes("listLoading")
-  waitForLoad() {
-    if (this.get("adRequested")) {
-      return;
-    } // already requested that this ad unit be populated
-    if (!this.get("listLoading")) {
-      Ember.run.scheduleOnce("afterRender", this, this._triggerAds);
-    }
-  },
-
-  @discourseComputed("currentUser.trust_level")
-  showToTrustLevel(trustLevel) {
-    return !(
-      trustLevel && trustLevel > this.siteSettings.codefund_through_trust_level
-    );
-  },
-
-  @discourseComputed(
-    "showToTrustLevel",
-    "showToGroups",
-    "showAfterPost",
-    "showOnCurrentPage"
-  )
-  showAd(showToTrustLevel, showToGroups, showAfterPost, showOnCurrentPage) {
-    return (
-      this.siteSettings.codefund_property_id &&
-      showToTrustLevel &&
-      showToGroups &&
-      showAfterPost &&
-      showOnCurrentPage
-    );
-  },
-
-  @discourseComputed("postNumber")
-  showAfterPost(postNumber) {
-    if (!postNumber) {
-      return true;
-    }
-
-    return this.isNthPost(parseInt(this.siteSettings.codefund_nth_post, 10));
-  }
-});
diff --git a/assets/javascripts/discourse/templates/components/codefund-ad.hbs b/assets/javascripts/discourse/templates/components/codefund-ad.hbs
deleted file mode 100644
index 1c0f80d..0000000
--- a/assets/javascripts/discourse/templates/components/codefund-ad.hbs
+++ /dev/null
@@ -1,29 +0,0 @@
-{{#if showAd}}
-  {{#if site.mobileView}}
-    {{#if displayPostBottom}}
-      {{partial "components/codefund/post-bottom"}}
-    {{/if}}
-    {{#if displayTopicAbovePostStream}}
-      {{partial "components/codefund/topic-above-post-stream"}}
-    {{/if}}
-    {{#if displayTopicAboveSuggested}}
-      {{partial "components/codefund/topic-above-suggested"}}
-    {{/if}}
-    {{#if displayTopicListTop}}
-      {{partial "components/codefund/topic-list-top"}}
-    {{/if}}
-  {{else}}
-    {{#if displayPostBottom}}
-      {{partial "components/codefund/post-bottom"}}
-    {{/if}}
-    {{#if displayTopicAbovePostStream}}
-      {{partial "components/codefund/topic-above-post-stream"}}
-    {{/if}}
-    {{#if displayTopicAboveSuggested}}
-      {{partial "components/codefund/topic-above-suggested"}}
-    {{/if}}
-    {{#if displayTopicListTop}}
-      {{partial "components/codefund/topic-list-top"}}
-    {{/if}}
-  {{/if}}
-{{/if}}
\ No newline at end of file
diff --git a/assets/javascripts/discourse/templates/components/codefund/post-bottom.hbs b/assets/javascripts/discourse/templates/components/codefund/post-bottom.hbs
deleted file mode 100644
index b7d990a..0000000
--- a/assets/javascripts/discourse/templates/components/codefund/post-bottom.hbs
+++ /dev/null
@@ -1,9 +0,0 @@
-<span class="codefund-wrapper codefund-post-bottom">
-  <a href="{{adDetails.campaignUrl}}" class="codefund-text" target="_blank" rel="noopener">

[... diff too long, it was truncated ...]

GitHub sha: 3fc87252

This commit appears in #85 which was approved by ZogStriP. It was merged by nbianca.