edemo / PDOauth

4 stars 5 forks source link

Gettext fails to call init_ #821

Closed magwas closed 7 years ago

magwas commented 7 years ago

After this: Gettext.outerStuff.push(self.init_)

self.init_ not always happen, leaving a half-initialized webpage in end-to-end tests

note: possible future merge conflict here, I have the following diff right now:

diff --git a/static/js/login.js b/static/js/login.js
index f929271..151e8d9 100644
--- a/static/js/login.js
+++ b/static/js/login.js
@@ -34,8 +34,13 @@
        if (keygenform) keygenform.action=self.QueryString.uris.BACKEND_PATH+"/v1/keygen";

        // waiting for gettext loads po files
-       if (!Gettext.isAllPoLoaded) Gettext.outerStuff.push(self.init_);
-       else self.init_()
+       if (!Gettext.isAllPoLoaded) {
+           window.traces.push("init after po")
+           Gettext.outerStuff.push(self.init_)
+       } else {
+           window.traces.push("init now")          
+           self.init_()
+       }
    }

    PageScript.prototype.init_=function(){
@@ -50,6 +55,7 @@
            self.greating("The %s application needs to sign in with your ADA account")
            self.unhideSection("login_section")
        }
+       window.traces.push('loginpage')
    }

    PageScript.prototype.userIsLoggedIn = function(text) {
@@ -77,6 +83,7 @@
                self.doRedirect(decodeURIComponent(self.QueryString.next))
            }
        }
+       window.traces.push('userIsLoggedIn')
    }

    PageScript.prototype.finishRegistration = function (text) {
@@ -105,6 +112,7 @@
                self.doRedirect(decodeURIComponent(self.QueryString.next))
            }
        }
+       window.traces.push("myApps")
    }

    PageScript.prototype.unhideAssuranceSection= function(assurance,given) {
Claymanus commented 7 years ago

Ez a rész gondoskodik arról, hogy az init csak akkor fusson le, amikor a po már betöltődött. Amúgy valszeg átállítom ajaxosra a po betöltését és akkor nem kell tökölni ezzel a self made eventtel.

Claymanus commented 7 years ago

the gettext lib has been removed. pls check

Claymanus commented 7 years ago

solved, doesn't?