Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
fix(logout): logging out should work in all browsers now
Browse files Browse the repository at this point in the history
closes #73
  • Loading branch information
seiyria committed Oct 31, 2015
1 parent 5f979c2 commit b112436
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 22 deletions.
8 changes: 4 additions & 4 deletions src/js/controllers/managers/tournamentManageCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ site.controller('tournamentManageController', ($scope, $state, ShareToken, Sideb

UserStatus.firebase.$loaded(() => {
$scope.isMine = UserStatus.firebase.playerSetUid === authData.uid;
});

CurrentTournaments.watch.then(null, null, () => {
CurrentTournaments.watch.then(null, null, () => {
$scope.loadTournaments();
});

$scope.loadTournaments();
});

$scope.loadTournaments();
});
26 changes: 14 additions & 12 deletions src/js/controllers/managers/userManageCtrl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import site from '../../app';

site.controller('userManageController', ($scope, $firebaseArray, $firebaseObject, FirebaseURL, ScoringFunctions, CurrentUsers, InputPrompt, UserStatus, CurrentPlayerBucket, CurrentTournaments, ShareManagement, SetManagement, SidebarManagement, EnsureLoggedIn, UserManagement, TournamentStatus, Toaster) => {
site.controller('userManageController', ($scope, $firebaseArray, $firebaseObject, Auth, FirebaseURL, ScoringFunctions, CurrentUsers, InputPrompt, UserStatus, CurrentPlayerBucket, CurrentTournaments, ShareManagement, SetManagement, SidebarManagement, EnsureLoggedIn, UserManagement, TournamentStatus, Toaster) => {

SidebarManagement.hasSidebar = true;
const authData = EnsureLoggedIn.check();
Expand Down Expand Up @@ -223,9 +223,6 @@ site.controller('userManageController', ($scope, $firebaseArray, $firebaseObject
$scope.selected = [];
};

$scope.tournaments = CurrentTournaments.get();
CurrentTournaments.watch.then(null, null, tournaments => $scope.tournaments = tournaments);

$scope.anyCompletedTournaments = () => _.any($scope.tournaments, t => t.status === TournamentStatus.COMPLETED);
$scope.allTournamentGames = () => _.uniq($scope.tournaments, t => t.game);

Expand Down Expand Up @@ -268,18 +265,23 @@ site.controller('userManageController', ($scope, $firebaseArray, $firebaseObject
};

$scope.load = () => {
UserStatus.firebase.$loaded(() => {
Auth.ready.then(() => {
UserStatus.firebase.$loaded(() => {

if(!UserStatus.firebase.playerSet) {
$scope.changePlayerSet('default');
}
if(!UserStatus.firebase.playerSet) {
$scope.changePlayerSet('default');
}

$scope.setCurrentPlayerSet(CurrentUsers.get());
$scope.setCurrentPlayerSet(CurrentUsers.get());

$scope.isMine = UserStatus.firebase.playerSetUid === authData.uid;
$scope.isMine = UserStatus.firebase.playerSetUid === authData.uid;

$scope.tournaments = CurrentTournaments.get();
CurrentTournaments.watch.then(null, null, tournaments => $scope.tournaments = tournaments);
});
$scope.loadAllLists();
$scope.loadSharedWithMe();
});
$scope.loadAllLists();
$scope.loadSharedWithMe();
};

$scope.load();
Expand Down
1 change: 0 additions & 1 deletion src/js/controllers/tournaments/inProgressCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ site.controller('inProgressController', ($scope, $timeout, EnsureLoggedIn, Sideb
const data = currentUsersInfo.users;
if(!data.shareIDs) return;
$scope.hasAccess = data && data.shareIDs[authData.uid] || defaultHasAccess();
console.log(data, defaultHasAccess(), UserStatus.firebase.playerSetUid, authData);
});
}

Expand Down
14 changes: 11 additions & 3 deletions src/js/services/currents/currentTournaments.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import site from '../../app';

site.service('CurrentTournaments', ($q, $firebaseArray, FirebaseURL, UserStatus) => {
site.service('CurrentTournaments', ($q, $firebaseArray, FirebaseURL, Auth, UserStatus, EnsureLoggedIn) => {

EnsureLoggedIn.check();

const defer = $q.defer();

let ref = $firebaseArray(new Firebase(`${FirebaseURL}/users/${UserStatus.firebase.playerSetUid}/players/${UserStatus.firebase.playerSet}/tournaments`));
let ref = {};

UserStatus.firebase.$watch(() => {
const load = () => {
ref = $firebaseArray(new Firebase(`${FirebaseURL}/users/${UserStatus.firebase.playerSetUid}/players/${UserStatus.firebase.playerSet}/tournaments`));
defer.notify(ref);
};

Auth.ready.then(() => {
UserStatus.firebase.$loaded(load);
UserStatus.firebase.$watch(load);
});

return {
Expand Down
4 changes: 2 additions & 2 deletions src/js/services/managers/shareManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import site from '../../app';

site.service('ShareManagement', (UserStatus, FirebaseURL, $firebaseArray) => {

const me = UserStatus.authData.uid;

const manageSorting = (oldSortsPlucked, newSorts, docId) => {
const me = UserStatus.authData.uid;

const newSortsPlucked = _.pluck(newSorts, 'uid');
const removals = _.difference(oldSortsPlucked, newSortsPlucked);
const additions = _.difference(newSortsPlucked, oldSortsPlucked);
Expand Down

0 comments on commit b112436

Please sign in to comment.