mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
show error in composer if upload fails
This commit is contained in:
@@ -605,7 +605,7 @@ define(['taskbar'], function(taskbar) {
|
|||||||
var currentText = textarea.val();
|
var currentText = textarea.val();
|
||||||
|
|
||||||
if(err) {
|
if(err) {
|
||||||
textarea.val(currentText.replace(imgText, linkStart + '[' + img.name + '](upload error)'));
|
textarea.val(currentText.replace(imgText, linkStart + '[' + img.name + ']( Error : ' + err.message + ')'));
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,46 +10,46 @@ var fs = require('fs'),
|
|||||||
var logFileName = 'events.log';
|
var logFileName = 'events.log';
|
||||||
|
|
||||||
events.logPasswordChange = function(uid) {
|
events.logPasswordChange = function(uid) {
|
||||||
log(uid, 'changed password');
|
logWithUser(uid, 'changed password');
|
||||||
}
|
}
|
||||||
|
|
||||||
events.logPasswordReset = function(uid) {
|
events.logPasswordReset = function(uid) {
|
||||||
log(uid, 'reset password');
|
logWithUser(uid, 'reset password');
|
||||||
}
|
}
|
||||||
|
|
||||||
events.logEmailChange = function(uid, oldEmail, newEmail) {
|
events.logEmailChange = function(uid, oldEmail, newEmail) {
|
||||||
log(uid,'changed email from "' + oldEmail + '" to "' + newEmail +'"');
|
logWithUser(uid,'changed email from "' + oldEmail + '" to "' + newEmail +'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
events.logUsernameChange = function(uid, oldUsername, newUsername) {
|
events.logUsernameChange = function(uid, oldUsername, newUsername) {
|
||||||
log(uid,'changed username from "' + oldUsername + '" to "' + newUsername +'"');
|
logWithUser(uid,'changed username from "' + oldUsername + '" to "' + newUsername +'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
events.logAdminLogin = function(uid) {
|
events.logAdminLogin = function(uid) {
|
||||||
log(uid, 'logged into admin panel');
|
logWithUser(uid, 'logged into admin panel');
|
||||||
}
|
}
|
||||||
|
|
||||||
events.logPostEdit = function(uid, pid) {
|
events.logPostEdit = function(uid, pid) {
|
||||||
log(uid, 'edited post (pid ' + pid + ')');
|
logWithUser(uid, 'edited post (pid ' + pid + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
events.logPostDelete = function(uid, pid) {
|
events.logPostDelete = function(uid, pid) {
|
||||||
log(uid, 'deleted post (pid ' + pid + ')');
|
logWithUser(uid, 'deleted post (pid ' + pid + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
events.logPostRestore = function(uid, pid) {
|
events.logPostRestore = function(uid, pid) {
|
||||||
log(uid, 'restored post (pid ' + pid + ')');
|
logWithUser(uid, 'restored post (pid ' + pid + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
events.logTopicDelete = function(uid, tid) {
|
events.logTopicDelete = function(uid, tid) {
|
||||||
log(uid, 'deleted topic (tid ' + tid + ')');
|
logWithUser(uid, 'deleted topic (tid ' + tid + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
events.logTopicRestore = function(uid, tid) {
|
events.logTopicRestore = function(uid, tid) {
|
||||||
log(uid, 'restored topic (tid ' + tid + ')');
|
logWithUser(uid, 'restored topic (tid ' + tid + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
function log(uid, string) {
|
function logWithUser(uid, string) {
|
||||||
|
|
||||||
user.getUserField(uid, 'username', function(err, username) {
|
user.getUserField(uid, 'username', function(err, username) {
|
||||||
if(err) {
|
if(err) {
|
||||||
@@ -57,9 +57,12 @@ var fs = require('fs'),
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var date = new Date().toUTCString();
|
var msg = '[' + new Date().toUTCString() + '] - ' + username + '(uid ' + uid + ') ' + string + '\n';
|
||||||
|
log(msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var msg = '[' + date + '] - ' + username + '(uid ' + uid + ') ' + string + '\n';
|
events.log = function(msg) {
|
||||||
var logFile = path.join(nconf.get('base_dir'), logFileName);
|
var logFile = path.join(nconf.get('base_dir'), logFileName);
|
||||||
|
|
||||||
fs.appendFile(logFile, msg, function(err) {
|
fs.appendFile(logFile, msg, function(err) {
|
||||||
@@ -68,7 +71,6 @@ var fs = require('fs'),
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
events.getLog = function(callback) {
|
events.getLog = function(callback) {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ var async = require('async'),
|
|||||||
cron = require('cron').CronJob,
|
cron = require('cron').CronJob,
|
||||||
|
|
||||||
db = require('./database'),
|
db = require('./database'),
|
||||||
utils = require('../public/src/utils');
|
utils = require('../public/src/utils'),
|
||||||
|
events = require('./events');
|
||||||
|
|
||||||
(function(Notifications) {
|
(function(Notifications) {
|
||||||
"use strict";
|
"use strict";
|
||||||
@@ -196,7 +197,6 @@ var async = require('async'),
|
|||||||
};
|
};
|
||||||
|
|
||||||
Notifications.prune = function(cutoff) {
|
Notifications.prune = function(cutoff) {
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
winston.info('[notifications.prune] Removing expired notifications from the database.');
|
winston.info('[notifications.prune] Removing expired notifications from the database.');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user