summaryrefslogtreecommitdiffstats
path: root/settings/js/authtoken_collection.js
diff options
context:
space:
mode:
Diffstat (limited to 'settings/js/authtoken_collection.js')
-rw-r--r--settings/js/authtoken_collection.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/settings/js/authtoken_collection.js b/settings/js/authtoken_collection.js
index dd964356d06..a78e053995f 100644
--- a/settings/js/authtoken_collection.js
+++ b/settings/js/authtoken_collection.js
@@ -26,9 +26,25 @@
OC.Settings = OC.Settings || {};
var AuthTokenCollection = Backbone.Collection.extend({
+
model: OC.Settings.AuthToken,
+
+ /**
+ * Show recently used sessions/devices first
+ *
+ * @param {OC.Settigns.AuthToken} t1
+ * @param {OC.Settigns.AuthToken} t2
+ * @returns {Boolean}
+ */
+ comparator: function (t1, t2) {
+ var ts1 = parseInt(t1.get('lastActivity'), 10);
+ var ts2 = parseInt(t2.get('lastActivity'), 10);
+ return ts1 < ts2;
+ },
+
tokenType: null,
- url: OC.generateUrl('/settings/personal/authtokens'),
+
+ url: OC.generateUrl('/settings/personal/authtokens')
});
OC.Settings.AuthTokenCollection = AuthTokenCollection;