From a5be161d6173d9275f1882c8da31cec8de6873d0 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 6 Feb 2015 10:35:46 +1030 Subject: [PATCH] Cleanup, remove some old code --- framework/core/ember/app/app.js | 63 +------------------ .../ember/app/initializers/authentication.js | 4 +- .../Core/Discussions/DiscussionFinder.php | 9 --- 3 files changed, 3 insertions(+), 73 deletions(-) diff --git a/framework/core/ember/app/app.js b/framework/core/ember/app/app.js index 601bc88f7..a1a2d02fb 100644 --- a/framework/core/ember/app/app.js +++ b/framework/core/ember/app/app.js @@ -13,65 +13,4 @@ var App = Ember.Application.extend({ loadInitializers(App, config.modulePrefix); -//----------------------------------------- -// TODO: Move all this to an initializer - -/* -import User from 'flarum/models/user'; - -// Authentication - -import BaseAuthenticator from 'simple-auth/authenticators/base'; - -var FlarumAuthenticator = BaseAuthenticator.extend({ - restore: function(data) { - // return Ember.RSVP.Promise.resolve(data); - }, - authenticate: function(credentials) { - return new Ember.RSVP.Promise(function(resolve, reject) { - Ember.$.ajax({ - url: 'http://localhost/public/Flarum/flarum/public/api/auth', - type: 'POST', - data: { type: 'password', identification: credentials.identification, password: credentials.password } - }).then(function(response) { - resolve({ token: response.token, userId: response.user.id }); - }, function(xhr, status, error) { - reject(xhr.responseText); - }); - }); - }, - // invalidate: function() { - // return Ember.RSVP.Promise.resolve(); - // } -}); - -import BaseAuthorizer from 'simple-auth/authorizers/base'; - -var FlarumAuthorizer = BaseAuthorizer.extend({ - -}); - -App.initializer({ - name: 'authentication', - initialize: function(container, application) { - container.register('authenticator:flarum', FlarumAuthenticator); - container.register('authorizer:flarum', FlarumAuthorizer); - - // customize the session so that it allows access to the account object - Ember.SimpleAuth.Session.reopen({ - user: function() { - var userId = this.get('userId'); - if (!userId) return; - return container.lookup('store:main').find('user', userId); - }.property('userId') - }); - - Ember.SimpleAuth.setup(container, application, { - authorizerFactory: 'authorizer:flarum', - routeAfterAuthentication: 'discussions' - }); - } -}); -*/ - -export default App; +export default App; \ No newline at end of file diff --git a/framework/core/ember/app/initializers/authentication.js b/framework/core/ember/app/initializers/authentication.js index 8ad528df0..cbe991bf1 100644 --- a/framework/core/ember/app/initializers/authentication.js +++ b/framework/core/ember/app/initializers/authentication.js @@ -1,8 +1,8 @@ import FlarumAuthorizer from '../authorizers/flarum'; export default { - name: 'authentication', - before: 'simple-auth', + name: 'authentication', + before: 'simple-auth', initialize: function(container) { container.register('authorizer:flarum', FlarumAuthorizer); } diff --git a/framework/core/src/Flarum/Core/Discussions/DiscussionFinder.php b/framework/core/src/Flarum/Core/Discussions/DiscussionFinder.php index 44b525fb5..a7d9cbd6d 100644 --- a/framework/core/src/Flarum/Core/Discussions/DiscussionFinder.php +++ b/framework/core/src/Flarum/Core/Discussions/DiscussionFinder.php @@ -30,15 +30,6 @@ class DiscussionFinder protected $fulltext; - public function __construct($user = null, $tokens = null, $sort = null, $order = null, $key = null) - { - $this->user = $user; - $this->tokens = $tokens; - $this->sort = $sort; - $this->order = $order; - $this->key = $key; - } - public function getUser() { return $this->user;