Skip to content

Node.js based forum software built for the modern web

breaking: remove deprecated uploads.delete

Barış Soner Uşaklıc93d7fdbdd46
diff --git a/src/socket.io/admin.js b/src/socket.io/admin.js
index cc523043a0..ff03929dcf 100644
--- a/src/socket.io/admin.js
+++ b/src/socket.io/admin.js
@@ -30,7 +30,6 @@ SocketAdmin.email = require('./admin/email');
SocketAdmin.analytics = require('./admin/analytics');
SocketAdmin.logs = require('./admin/logs');
SocketAdmin.errors = require('./admin/errors');
-SocketAdmin.uploads = require('./admin/uploads');
SocketAdmin.digest = require('./admin/digest');
SocketAdmin.cache = require('./admin/cache');
diff --git a/src/socket.io/admin/uploads.js b/src/socket.io/admin/uploads.js
deleted file mode 100644
index 32e1e334d3..0000000000
--- a/src/socket.io/admin/uploads.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict';
-
-const fs = require('fs');
-const path = require('path');
-const nconf = require('nconf');
-
-const sockets = require('..');
-
-const Uploads = module.exports;
-
-Uploads.delete = function (socket, pathToFile, callback) {
- sockets.warnDeprecated(socket, 'DELETE /api/v3/files');
-
- pathToFile = path.join(nconf.get('upload_path'), pathToFile);
- if (!pathToFile.startsWith(nconf.get('upload_path'))) {
- return callback(new Error('[[error:invalid-path]]'));
- }
-
- fs.unlink(pathToFile, callback);
-};
diff --git a/test/authentication.js b/test/authentication.js
index 1b796f5797..a152c2239c 100644
--- a/test/authentication.js
+++ b/test/authentication.js
@@ -29,7 +29,7 @@ describe('authentication', () => {
it('should allow login with email for uid 1', async () => {
const oldValue = meta.config.allowLoginWith;
- meta.config.allowLoginWith = 'email';
+ meta.config.allowLoginWith = 'username-email';
const { res } = await helpers.loginUser('[email protected]', 'regularpwd');
assert.strictEqual(res.statusCode, 200);
meta.config.allowLoginWith = oldValue;
@@ -37,7 +37,7 @@ describe('authentication', () => {
it('second user should fail to login with email since email is not confirmed', async () => {
const oldValue = meta.config.allowLoginWith;
- meta.config.allowLoginWith = 'email';
+ meta.config.allowLoginWith = 'username-email';
const uid = await user.create({ username: '2nduser', password: '2ndpassword', email: '[email protected]' });
const { res, body } = await helpers.loginUser('[email protected]', '2ndpassword');
assert.strictEqual(res.statusCode, 403);