Compare commits

...

40 Commits

Author SHA1 Message Date
Julian Lam
0debcdca56 Backported a3dc427e67
Fixed improper handling of chat dropdown.
2016-04-17 09:58:47 -04:00
Julian Lam
fde31d5112 updated shrinkwrap file 2016-02-24 11:06:58 -05:00
Julian Lam
79107d7a26 0.9.4 2016-02-24 11:00:41 -05:00
Barış Soner Uşaklı
27d3f43bf0 Merge pull request #4173 from manolino/v0.9.x
Cumulative PR. Various for handle topic "post move"
2016-02-10 20:25:31 +02:00
manolino
9666ac35a2 Cumulative PR. Various for handle topic "post move"
Added `event:post_moved` event so when you move a post you have top and
bottom post counters updated.
No new function needed, linked to `onPostPurged` function, because it do
the same work for `event:topic_purged`.
Added `from_tid` to socket data to handle new event  `event:post_moved`
and also added `websocket.in(...` to emit just implemented client side
event `event:post_moved` so top and bottom counters are updated in real
time when a post is moved. (see other commits #4145 #4146 #4147 ).
2016-02-10 11:41:05 -06:00
Barış Soner Uşaklı
cf5decf5de backport spelling fix 2016-01-19 00:46:05 +02:00
Barış Soner Uşaklı
6486197623 backport action:script.load 2016-01-15 22:10:45 +02:00
Barış Soner Uşaklı
3a475cbbce backport parseInt fix for thumbs 2016-01-13 22:50:00 +02:00
Barış Soner Uşaklı
cccc567854 backport group slug fix 2016-01-10 20:52:23 +02:00
Barış Soner Uşaklı
a9659de87e backport getRecentTopicReplies fix 2016-01-10 11:02:11 +02:00
Barış Soner Uşaklı
b0e3cfcd6d backport redis view count fix 2016-01-08 13:21:23 +02:00
Julian Lam
34a725c9da Merge pull request #4013 from machado2/v0.9.x
removed utf-8-validate and bufferutil from npm-shrinkwrap.json as sug…
2015-12-29 11:57:56 -05:00
Fábio Machado de Oliveira
6d859abc22 removed utf-8-validate and bufferutil from npm-shrinkwrap.json as suggested by @feio at https://community.nodebb.org/topic/7302/fatal-error-nan-h-no-such-file-or-directory/4 2015-12-28 21:47:59 -02:00
Barış Soner Uşaklı
9043a40c35 backport private group fixes 2015-12-28 14:37:53 +02:00
Julian Lam
711983d580 more notif crash fixes 2015-12-23 09:50:49 -05:00
Julian Lam
af38ec6426 fixing notifications crash again 2015-12-22 13:54:20 -05:00
Barış Soner Uşaklı
6d2e91bc28 backport remove cover fix 2015-12-22 15:03:31 +02:00
Julian Lam
e687310cdc more tweaks to notif grouping 2015-12-21 15:29:25 -05:00
Julian Lam
2c9e293680 fix #3965 2015-12-21 14:30:03 -05:00
Julian Lam
9f14e8ee05 fixing another null crash 2015-12-19 12:14:17 -05:00
Barış Soner Uşaklı
f0217ee198 fix related 2015-12-19 19:11:00 +02:00
Julian Lam
da78e4f02b updated shrinkwrap file 2015-12-19 11:09:16 -05:00
Julian Lam
99507f6243 Merge branch 'master' into v0.9.x 2015-12-19 11:06:50 -05:00
Barış Soner Uşaklı
7d913f3420 parseInt limit 2015-12-17 08:59:51 +02:00
Barış Soner Uşaklı
9fb14bd510 Update move.js 2015-12-13 18:07:07 +02:00
Julian Lam
64b044bd51 updated shrinkwrap file 2015-12-10 17:24:25 -05:00
Julian Lam
f025d7ddbf Merge branch 'master' into v0.9.x 2015-12-10 17:18:33 -05:00
Julian Lam
fdf9231981 Merge branch 'master' into v0.9.x 2015-12-10 16:01:47 -05:00
Julian Lam
d4abd87112 fixes #3909 2015-11-28 21:40:32 -05:00
Julian Lam
6d9adac6e4 fixed LRU cache problem 2015-11-26 23:35:15 -05:00
Julian Lam
f0c4052725 updated shrinkwrap file 2015-11-26 23:30:42 -05:00
Julian Lam
57b033b6d1 Merge branch 'master' into v0.9.x 2015-11-26 23:28:48 -05:00
Barış Soner Uşaklı
4d13fb6809 disable post cache on prod, dont set it if no pid 2015-11-26 18:03:41 -05:00
Julian Lam
cee3918e9b fixing crash on settings save 2015-11-08 11:58:06 -05:00
Julian Lam
05ef18fb2e Merge branch 'master' into v0.9.x 2015-11-07 11:30:49 -05:00
Julian Lam
101228711f Merge branch 'master' into v0.9.x 2015-11-07 10:41:29 -05:00
Julian Lam
79c0049922 updated shrinkwrap file 2015-11-06 17:43:22 -05:00
Julian Lam
7945ae071b Merge branch 'master' into v0.9.x 2015-11-06 17:41:11 -05:00
Julian Lam
e911256c9c 0.9.0 2015-11-06 16:08:59 -05:00
Julian Lam
15cf2f58b4 updated shrinkwrap file 2015-11-06 16:07:31 -05:00
18 changed files with 4124 additions and 49 deletions

View File

@@ -1,10 +1,10 @@
# Welcome to your brand new NodeBB forum!
This is what a topic and post looks like. As an administator, you can edit the post\'s title and content.
This is what a topic and post looks like. As an administrator, you can edit the post\'s title and content.
To customise your forum, go to the [Administrator Control Panel](../../admin). You can modify all aspects of your forum there, including installation of third-party plugins.
## Additional Resources
* [NodeBB Documentation](https://docs.nodebb.org)
* [Community Support Forum](https://community.nodebb.org)
* [Project repository](https://github.com/nodebb/nodebb)
* [Project repository](https://github.com/nodebb/nodebb)

4034
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"name": "nodebb",
"license": "GPL-3.0",
"description": "NodeBB Forum",
"version": "0.9.3",
"version": "0.9.4",
"homepage": "http://www.nodebb.org",
"repository": {
"type": "git",

View File

@@ -195,7 +195,14 @@ $(document).ready(function() {
ajaxify.loadScript = function(tpl_url, callback) {
var location = !app.inAdmin ? 'forum/' : '';
require([location + tpl_url], function(script) {
var data = {
tpl_url: tpl_url,
scripts: [location + tpl_url]
};
$(window).trigger('action:script.load', data);
require(data.scripts, function(script) {
if (script && script.init) {
script.init();
}
@@ -312,4 +319,4 @@ $(document).ready(function() {
templates.cache[$(this).attr('data-template')] = $(this).html();
});
});
});

View File

@@ -1,14 +1,15 @@
'use strict';
/* globals config, app, ajaxify, define, socket, templates, translator, utils */
/* globals config, app, ajaxify, define, socket, templates, utils */
define('forum/topic/events', [
'forum/topic/postTools',
'forum/topic/threadTools',
'forum/topic/posts',
'components'
], function(postTools, threadTools, posts, components) {
'components',
'translator'
], function(postTools, threadTools, posts, components, translator) {
var Events = {};
@@ -31,6 +32,7 @@ define('forum/topic/events', [
'event:post_edited': onPostEdited,
'event:post_purged': onPostPurged,
'event:post_moved': onPostPurged,
'event:post_deleted': togglePostDeleteState,
'event:post_restored': togglePostDeleteState,

View File

@@ -390,7 +390,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
}
function movePost(post, pid, tid, callback) {
socket.emit('posts.movePost', {pid: pid, tid: tid}, function(err) {
socket.emit('posts.movePost', {pid: pid, tid: tid, from_tid: ajaxify.data.tid}, function(err) {
if (err) {
app.alertError(err.message);
return callback();

View File

@@ -32,7 +32,7 @@ module.exports = function(Categories) {
Categories.getRecentTopicReplies = function(categoryData, uid, callback) {
if (!Array.isArray(categoryData) || !categoryData.length) {
return callback(null, []);
return callback();
}
async.waterfall([

View File

@@ -73,7 +73,7 @@ uploadsController.uploadThumb = function(req, res, next) {
}
if (uploadedFile.type.match(/image./)) {
var size = meta.config.topicThumbSize || 120;
var size = parseInt(meta.config.topicThumbSize, 10) || 120;
image.resizeImage({
path: uploadedFile.path,
extension: path.extname(uploadedFile.name),

View File

@@ -87,4 +87,4 @@ module.exports = function(db, module) {
module.pexpireAt = function(key, timestamp, callback) {
module.setObjectField(key, 'expireAt', new Date(timestamp), callback);
};
};
};

View File

@@ -277,7 +277,7 @@ var db = require('./database'),
});
next(undefined, messages);
} else {
} else if (messages.length === 1) {
// For single messages, we don't know the context, so look up the previous message and compare
var uids = [fromuid, touid].sort(function(a, b) { return a > b ? 1 : -1 });
var key = 'messages:uid:' + uids[0] + ':to:' + uids[1];
@@ -310,6 +310,8 @@ var db = require('./database'),
next(undefined, messages);
});
} else {
next(null, []);
}
}
], callback);

View File

@@ -29,6 +29,7 @@ var async = require('async'),
/* Assorted */
Meta.userOrGroupExists = function(slug, callback) {
slug = utils.slugify(slug);
async.parallel([
async.apply(user.existsBySlug, slug),
async.apply(groups.existsBySlug, slug)

View File

@@ -340,11 +340,11 @@ var async = require('async'),
'notifications:user_posted_to',
'notifications:user_flagged_post_in'
],
isolated, differentiator, modifyIndex;
isolated, differentiators, differentiator, modifyIndex, set;
notifications = mergeIds.reduce(function(notifications, mergeId) {
isolated = notifications.filter(function(notifObj) {
if (!notifObj.hasOwnProperty('mergeId')) {
if (!notifObj || !notifObj.hasOwnProperty('mergeId')) {
return false;
}
@@ -355,34 +355,56 @@ var async = require('async'),
return notifications; // Nothing to merge
}
differentiator = isolated[0].mergeId.split('|')[1];
// Each isolated mergeId may have multiple differentiators, so process each separately
differentiators = isolated.reduce(function(cur, next) {
differentiator = next.mergeId.split('|')[1];
if (cur.indexOf(differentiator) === -1) {
cur.push(differentiator);
}
modifyIndex = notifications.indexOf(isolated[0]);
return cur;
}, []);
differentiators.forEach(function(differentiator) {
set = isolated.filter(function(notifObj) {
return notifObj.mergeId === (mergeId + '|' + differentiator);
});
modifyIndex = notifications.indexOf(set[0]);
if (modifyIndex === -1 || set.length === 1) {
return notifications;
}
switch(mergeId) {
case 'notifications:favourited_your_post_in': // intentional fall-through
case 'notifications:upvoted_your_post_in':
case 'notifications:user_started_following_you':
case 'notifications:user_posted_to':
case 'notifications:user_flagged_post_in':
var usernames = isolated.map(function(notifObj) {
return notifObj.user.username;
});
var numUsers = usernames.length;
switch(mergeId) {
case 'notifications:favourited_your_post_in': // intentional fall-through
case 'notifications:upvoted_your_post_in':
case 'notifications:user_started_following_you':
case 'notifications:user_posted_to':
case 'notifications:user_flagged_post_in':
var usernames = set.map(function(notifObj) {
return notifObj.user.username;
});
var numUsers = usernames.length;
// Update bodyShort
if (numUsers === 2) {
isolated[0].bodyShort = '[[' + mergeId + '_dual, ' + usernames.join(', ') + ', ' + isolated[0].topicTitle + ']]'
} else {
isolated[0].bodyShort = '[[' + mergeId + '_multiple, ' + usernames[0] + ', ' + (numUsers-1) + ', ' + isolated[0].topicTitle + ']]'
// Update bodyShort
if (numUsers === 2) {
notifications[modifyIndex].bodyShort = '[[' + mergeId + '_dual, ' + usernames.join(', ') + ', ' + notifications[modifyIndex].topicTitle + ']]'
} else {
notifications[modifyIndex].bodyShort = '[[' + mergeId + '_multiple, ' + usernames[0] + ', ' + (numUsers-1) + ', ' + notifications[modifyIndex].topicTitle + ']]'
}
break;
}
// Filter out duplicates
notifications = notifications.filter(function(notifObj, idx) {
if (!notifObj || !notifObj.mergeId) {
return true;
}
break;
}
// Filter out duplicates
return notifications.filter(function(notifObj, idx) {
return notifObj.mergeId !== mergeId + '|' + differentiator || idx === modifyIndex;
return !(notifObj.mergeId === (mergeId + '|' + differentiator) && idx !== modifyIndex);
});
});
return notifications;
}, notifications);
plugins.fireHook('filter:notifications.merge', {

View File

@@ -270,7 +270,7 @@ function getHourlyStatsForSet(set, hour, numHours, callback) {
}
hoursArr.forEach(function(term, index) {
terms[term] = counts[index] || 0;
terms[term] = parseInt(counts[index], 10) || 0;
});
var termsArr = [];

View File

@@ -22,6 +22,10 @@ SocketGroups.join = function(socket, data, callback) {
return callback(new Error('[[error:invalid-uid]]'));
}
if (data.groupName === 'administrators' || groups.isPrivilegeGroup(data.groupName)) {
return callback(new Error('[[error:not-allowed]]'));
}
groups.exists(data.groupName, function(err, exists) {
if (err || !exists) {
return callback(err || new Error('[[error:no-group]]'));
@@ -39,10 +43,10 @@ SocketGroups.join = function(socket, data, callback) {
return callback(err);
}
if (checks.isPrivate && !checks.isAdmin) {
groups.requestMembership(data.groupName, socket.uid, callback);
} else {
if (!checks.isPrivate || checks.isAdmin) {
groups.join(data.groupName, socket.uid, callback);
} else {
groups.requestMembership(data.groupName, socket.uid, callback);
}
});
});

View File

@@ -4,6 +4,7 @@ var async = require('async');
var privileges = require('../../privileges');
var topics = require('../../topics');
var socketHelpers = require('../helpers');
var websockets = require('../index');
module.exports = function(SocketPosts) {
@@ -12,7 +13,7 @@ module.exports = function(SocketPosts) {
return callback(new Error('[[error:not-logged-in]]'));
}
if (!data || !data.pid || !data.tid) {
if (!data || !data.pid || !data.tid || !data.from_tid) {
return callback(new Error('[[error:invalid-data]]'));
}
@@ -29,6 +30,8 @@ module.exports = function(SocketPosts) {
},
function (next) {
socketHelpers.sendNotificationToPostOwner(data.pid, socket.uid, 'notifications:moved_your_post');
websockets.in('topic_' + data.from_tid).emit('event:post_moved', data.pid);
next();
}
], callback);

View File

@@ -71,4 +71,4 @@ module.exports = function(SocketTopics) {
}
], callback);
};
};
};

View File

@@ -42,9 +42,9 @@ module.exports = function(SocketUser) {
return callback(new Error('[[error:no-privileges]]'));
}
user.isAdministrator(socket.uid, function(err, isAdmin) {
if (!isAdmin && data.uid !== socket.uid) {
return callback(new Error('[[error:no-privileges]]'));
user.isAdminOrSelf(socket.uid, data.uid, function(err) {
if (err) {
return callback(err);
}
user.removeCoverPicture(data, callback);
@@ -154,4 +154,4 @@ module.exports = function(SocketUser) {
};
};
};

View File

@@ -330,7 +330,7 @@ module.exports = function(Topics) {
var maximumTopics = parseInt(meta.config.maximumRelatedTopics, 10) || 5;
if (!topicData.tags.length || maximumTopics === 0) {
return callback(null, topicData);
return callback(null, []);
}
async.waterfall([
@@ -351,4 +351,4 @@ module.exports = function(Topics) {
}
], callback);
};
};
};