root community var www nodebb git diff diff --git public src app js pu

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
root@community:/var/www/nodebb# git diff
diff --git a/public/src/app.js b/public/src/app.js
index 35037c8..c037aa1 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -486,6 +486,26 @@ app.uid = null;
});
}
+ function handleNewTopic() {^M
+ $('#content').on('click', '#new_topic', function() {^M
+ require(['composer'], function(composer) {^M
+ var cid = ajaxify.variables.get('category_id');^M
+ if (cid) {^M
+ composer.newTopic(cid);^M
+ } else {^M
+ socket.emit('categories.getCategoriesByPrivilege', 'topics:create', function(err, categories) {^M
+ if (err) {^M
+ return app.alertError(err.message);^M
+ }^M
+ if (categories.length) {^M
+ composer.newTopic(categories[0].cid);^M
+ }^M
+ });^M
+ }^M
+ });^M
+ });^M
+ }^M
+^M
app.load = function() {
$('document').ready(function () {
var url = ajaxify.removeRelativePath(window.location.pathname.slice(1).replace(/\/$/, "")),
@@ -508,6 +528,8 @@ app.uid = null;
handleSearch();
}
+ handleNewTopic();^M
+^M
$('#logout-link').on('click', app.logout);
Visibility.change(function(e, state){