DEV: attempts to prevent session object to be retain in csrf init (#7743)

approved
#1

DEV: attempts to prevent session object to be retain in csrf init (#7743)

diff --git a/app/assets/javascripts/discourse/initializers/csrf-token.js.es6 b/app/assets/javascripts/discourse/initializers/csrf-token.js.es6
index fd95c27..5fd21b3 100644
--- a/app/assets/javascripts/discourse/initializers/csrf-token.js.es6
+++ b/app/assets/javascripts/discourse/initializers/csrf-token.js.es6
@@ -1,15 +1,16 @@
 //  Append our CSRF token to AJAX requests when necessary.
 export default {
   name: "csrf-token",
-  initialize: function(container) {
-    var session = container.lookup("session:main");
+  initialize(container) {
+    const session = container.lookup("session:main");
+    const csrfToken = $("meta[name=csrf-token]").attr("content");
 
     // Add a CSRF token to all AJAX requests
-    session.set("csrfToken", $("meta[name=csrf-token]").attr("content"));
+    session.set("csrfToken", csrfToken);
 
     $.ajaxPrefilter(function(options, originalOptions, xhr) {
       if (!options.crossDomain) {
-        xhr.setRequestHeader("X-CSRF-Token", session.get("csrfToken"));
+        xhr.setRequestHeader("X-CSRF-Token", csrfToken);
       }
     });
   }

GitHub sha: 62c56b6e

Revert "DEV: attempts to prevent session object to be retain in csrf init (#7743)"
Followed Up #2

Revert "DEV: attempts to prevent session object to be retain in csrf init (#7743)"

Approved #3