Skip to content

Commit 967f488

Browse files
Paul VarachePaul Varache
authored andcommitted
fix: use classic functions
1 parent dd9e369 commit 967f488

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

lib/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ app.run(['$rootScope', '$window', '$location', '_config', ($rootScope, $window,
5656
* Updates the user and loggedIn state in the $rootScope
5757
*/
5858
$rootScope.updateUser = function (user) {
59-
$rootScope.user = user;
6059
if (user) {
60+
const { avatar } = user;
61+
const parsed = new URL(avatar);
62+
user.avatar = `${parsed.origin}/${user.id}/vanilla/head.png`;
6163
$rootScope.loggedIn = true;
6264
if (user.admin_level > 0) {
6365
$rootScope.loadUserProfile(user.id);
@@ -66,6 +68,7 @@ app.run(['$rootScope', '$window', '$location', '_config', ($rootScope, $window,
6668
} else {
6769
$rootScope.loggedIn = false;
6870
}
71+
$rootScope.user = user;
6972
prepareGamification(api.client, user ? user.id : 'anonymous', 'anonymous')
7073
.then((gamificationClient) => {
7174
$rootScope.gamification = gamificationClient;

lib/language/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,13 @@ function run(code, settings) {
6464
};
6565
}
6666

67+
const post = compiled.js.replace(/\(\)\s?=>/, 'function ()');
68+
6769
// Evaluate compiled JavaScript in build context
6870
try {
69-
evalInContext.bind({})(compiled.js);
71+
evalInContext.bind({})(post);
7072
} catch (err) {
73+
console.log(err);
7174
// Trace back error location from compiled source map
7275
var jsLoc = getErrorLocation(err),
7376
coffeeLoc = jsLoc ? compiled.sourceMap.sourceLocation(jsLoc) : null;
@@ -209,7 +212,7 @@ function evalInContext(code) {
209212
${code}
210213
}`);
211214

212-
const runner = fn()
215+
const runner = fn();
213216

214217
runner(...values);
215218
}

views/partial/header.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ header: .main-navigation.page-width
2929
| ${{ partial.signup }}$
3030

3131
li(ng-if='!offline && loggedIn')
32-
a.user-display(ng-href='http://world.kano.me/users/{{ user.username }}', target='_blank')
33-
.avatar: img(ng-src='{{ user.avatar.urls.circle || cfg.DEFAULT_AVATAR }}')
32+
a.user-display(ng-href='http://world.kano.me/profile/creations', target='_blank')
33+
.avatar: img(ng-src='{{ user.avatar }}')
3434
| {{ user.username }}
3535

3636
li(ng-if='!offline && loggedIn'): a(href='', ng-click='logout()')

0 commit comments

Comments
 (0)