mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
changed new Date().getTime() to Date.now() on server side
This commit is contained in:
@@ -34,7 +34,7 @@ var RDB = require('./redis.js'),
|
||||
'text', text || '',
|
||||
'score', score || 5,
|
||||
'path', path || null,
|
||||
'datetime', new Date().getTime(),
|
||||
'datetime', Date.now(),
|
||||
'uniqueId', uniqueId || utils.generateUUID(),
|
||||
function(err, status) {
|
||||
if (status === 'OK') callback(nid);
|
||||
|
||||
@@ -56,7 +56,7 @@ marked.setOptions({
|
||||
PostTools.edit = function(uid, pid, title, content) {
|
||||
var success = function() {
|
||||
RDB.set('pid:' + pid + ':content', content);
|
||||
RDB.set('pid:' + pid + ':edited', new Date().getTime());
|
||||
RDB.set('pid:' + pid + ':edited', Date.now());
|
||||
RDB.set('pid:' + pid + ':editor', uid);
|
||||
|
||||
posts.get_tid_by_pid(pid, function(tid) {
|
||||
|
||||
@@ -167,7 +167,7 @@ marked.setOptions({
|
||||
|
||||
|
||||
user.getUserField(uid, 'lastposttime', function(lastposttime) {
|
||||
if(new Date().getTime() - lastposttime < config.post_delay) {
|
||||
if(Date.now() - lastposttime < config.post_delay) {
|
||||
socket.emit('event:alert', {
|
||||
title: 'Too many posts!',
|
||||
message: 'You can only post every '+ (config.post_delay / 1000) + ' seconds.',
|
||||
@@ -185,7 +185,7 @@ marked.setOptions({
|
||||
|
||||
Posts.get_cid_by_pid(pid, function(cid) {
|
||||
RDB.del('cid:' + cid + ':read_by_uid');
|
||||
RDB.zadd('categories:recent_posts:cid:' + cid, (new Date()).getTime(), pid);
|
||||
RDB.zadd('categories:recent_posts:cid:' + cid, Date.now(), pid);
|
||||
});
|
||||
|
||||
// Re-add the poster, so he/she does not get an "unread" flag on this topic
|
||||
@@ -204,7 +204,7 @@ marked.setOptions({
|
||||
|
||||
user.getUserFields(uid, ['username','reputation','picture','signature'], function(data) {
|
||||
|
||||
var timestamp = new Date().getTime();
|
||||
var timestamp = Date.now();
|
||||
|
||||
io.sockets.in('topic_' + tid).emit('event:new_post', {
|
||||
'posts' : [
|
||||
@@ -248,7 +248,7 @@ marked.setOptions({
|
||||
RDB.incr('global:next_post_id', function(err, pid) {
|
||||
RDB.handle(err);
|
||||
|
||||
var timestamp = new Date().getTime();
|
||||
var timestamp = Date.now();
|
||||
// Posts Info
|
||||
RDB.set('pid:' + pid + ':content', content);
|
||||
RDB.set('pid:' + pid + ':uid', uid);
|
||||
|
||||
@@ -322,7 +322,7 @@ marked.setOptions({
|
||||
|
||||
user.getUserField(uid, 'lastposttime', function(lastposttime) {
|
||||
|
||||
if(new Date().getTime() - lastposttime < config.post_delay) {
|
||||
if(Date.now() - lastposttime < config.post_delay) {
|
||||
socket.emit('event:alert', {
|
||||
title: 'Too many posts!',
|
||||
message: 'You can only post every '+ (config.post_delay / 1000) + ' seconds.',
|
||||
@@ -350,7 +350,7 @@ marked.setOptions({
|
||||
RDB.set(schema.topics(tid).title, title);
|
||||
RDB.set(schema.topics(tid).uid, uid);
|
||||
RDB.set(schema.topics(tid).slug, slug);
|
||||
RDB.set(schema.topics(tid).timestamp, new Date().getTime());
|
||||
RDB.set(schema.topics(tid).timestamp, Date.now());
|
||||
|
||||
RDB.set('topic:slug:' + slug + ':tid', tid);
|
||||
|
||||
@@ -384,7 +384,7 @@ marked.setOptions({
|
||||
// let everyone know that there is an unread topic in this category
|
||||
RDB.del('cid:' + category_id + ':read_by_uid');
|
||||
|
||||
RDB.zadd(schema.topics().recent, (new Date()).getTime(), tid);
|
||||
RDB.zadd(schema.topics().recent, Date.now(), tid);
|
||||
//RDB.zadd('topics:active', tid);
|
||||
|
||||
// in future it may be possible to add topics to several categories, so leaving the door open here.
|
||||
|
||||
@@ -286,7 +286,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
||||
userSockets[touid][x].emit('chatMessage', {fromuid:uid, username:username, message:finalMessage});
|
||||
}
|
||||
|
||||
notifications.create(finalMessage, 5, '', 'notification_'+new Date().getTime(), function(nid) {
|
||||
notifications.create(finalMessage, 5, '', 'notification_'+Date.now(), function(nid) {
|
||||
notifications.push(nid, [touid], function(success) {
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user