Commit f457c80b authored by Nick Stenning's avatar Nick Stenning

Fix thread sorting

cf410d0 broke thread sorting by interfering with the (admittedly
arcane) sort apparatus.

There is a scope.watch in the AppController which is responsible for
filling the `predicate` field of the `sort` object when the `name` field
changes. In order for this to work, the controllers in child scopes
(namely StreamController or WidgetController) need to modify the `name`
property of the `sort` object in the parent scope, via prototypal
inheritance, rather than replacing the entire `sort` object.
parent 23ef8405
......@@ -33,6 +33,9 @@ module.exports = class AppController
# Check to see if we are on the stream page so we can hide share button.
$scope.isEmbedded = $window.top isnt $window
# Default sort
$scope.sort = name: 'Location'
identity.watch({
onlogin: (identity) -> $scope.auth.user = auth.userid(identity)
onlogout: -> $scope.auth.user = null
......
......@@ -51,7 +51,7 @@ module.exports = class StreamController
fetch(20)
$scope.isStream = true
$scope.sort = name: 'Newest'
$scope.sort.name = 'Newest'
$scope.threadRoot = threading.root
$scope.shouldShowThread = (container) -> true
......
......@@ -11,7 +11,6 @@ module.exports = class WidgetController
streamer, streamFilter, store, threading
) ->
$scope.isStream = true
$scope.sort = name: 'Location'
$scope.threadRoot = threading.root
@chunkSize = 200
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment