Revert "fix tests, crsf token meta is not present on tests (#7733)"

Revert “fix tests, crsf token meta is not present on tests (#7733)”

This reverts commit 240b61e844ebcd308386a0e6ed737066d7f4a4fb.

diff --git a/app/assets/javascripts/discourse/initializers/csrf-token.js.es6 b/app/assets/javascripts/discourse/initializers/csrf-token.js.es6
index 34839a4..b76a8b7 100644
--- a/app/assets/javascripts/discourse/initializers/csrf-token.js.es6
+++ b/app/assets/javascripts/discourse/initializers/csrf-token.js.es6
@@ -4,19 +4,18 @@ export default {
 
   initialize(container) {
     const session = container.lookup("session:main");
-    const meta = document.querySelector("meta[name=csrf-token]");
 
-    if (meta) {
-      const csrfToken = meta.getAttribute("content");
+    const csrfToken = document
+      .querySelector("meta[name=csrf-token]")
+      .getAttribute("content");
 
-      // Add a CSRF token to all AJAX requests
-      session.set("csrfToken", csrfToken);
+    // Add a CSRF token to all AJAX requests
+    session.set("csrfToken", csrfToken);
 
-      $.ajaxPrefilter((options, originalOptions, xhr) => {
-        if (!options.crossDomain) {
-          xhr.setRequestHeader("X-CSRF-Token", csrfToken);
-        }
-      });
-    }
+    $.ajaxPrefilter((options, originalOptions, xhr) => {
+      if (!options.crossDomain) {
+        xhr.setRequestHeader("X-CSRF-Token", csrfToken);
+      }
+    });
   }
 };

GitHub sha: ebecd0b7