change federateBlocks default to false
This commit is contained in:
parent
87faaac49e
commit
c5e5fb1162
6 changed files with 36 additions and 17 deletions
|
@ -46,6 +46,7 @@
|
|||
"devDependencies": {
|
||||
"@types/gulp": "4.0.9",
|
||||
"@types/gulp-rename": "2.0.1",
|
||||
"@types/sinon": "^10.0.13",
|
||||
"@typescript-eslint/parser": "^5.36.2",
|
||||
"cross-env": "7.0.3",
|
||||
"cypress": "10.3.0",
|
||||
|
|
|
@ -4,7 +4,7 @@ export class userBlockFederation1631880003000 implements MigrationInterface {
|
|||
name = 'userBlockFederation1631880003000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "user" ADD "federateBlocks" boolean NOT NULL DEFAULT true`);
|
||||
await queryRunner.query(`ALTER TABLE "user" ADD "federateBlocks" boolean NOT NULL DEFAULT false`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
"@types/koa__cors": "3.1.1",
|
||||
"@types/koa__multer": "2.0.4",
|
||||
"@types/koa__router": "8.0.11",
|
||||
"@types/mocha": "9.1.1",
|
||||
"@types/mocha": "^10.0.0",
|
||||
"@types/node": "18.7.16",
|
||||
"@types/node-fetch": "3.0.3",
|
||||
"@types/nodemailer": "6.4.5",
|
||||
|
|
|
@ -219,7 +219,7 @@ export class User {
|
|||
public token: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
default: true,
|
||||
default: false,
|
||||
})
|
||||
public federateBlocks: boolean;
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@ process.env.NODE_ENV = 'test';
|
|||
|
||||
import * as assert from 'assert';
|
||||
import * as childProcess from 'child_process';
|
||||
import { async, signup, request, post, startServer, shutdownServer, initTestDb } from '../utils';
|
||||
import { describe, before, beforeEach, after, it } from 'mocha';
|
||||
import * as sinon from 'sinon';
|
||||
import { async, signup, startServer, shutdownServer, initTestDb } from '../utils';
|
||||
|
||||
describe('Creating a block activity', () => {
|
||||
let p: childProcess.ChildProcess;
|
||||
|
@ -31,19 +32,19 @@ describe('Creating a block activity', () => {
|
|||
await shutdownServer(p);
|
||||
});
|
||||
|
||||
it('Should federate blocks normally', async(async () => {
|
||||
it('Should not federate blocks normally', async(async () => {
|
||||
const createBlock = (await import('../../src/services/blocking/create')).default;
|
||||
const deleteBlock = (await import('../../src/services/blocking/delete')).default;
|
||||
|
||||
const queues = await import('../../src/queue/index');
|
||||
const spy = sinon.spy(queues, 'deliver');
|
||||
await createBlock(alice, bob);
|
||||
assert(spy.calledOnce);
|
||||
assert(spy.notCalled);
|
||||
await deleteBlock(alice, bob);
|
||||
assert(spy.calledTwice);
|
||||
assert(spy.notCalled);
|
||||
}));
|
||||
|
||||
it('Should not federate blocks if federateBlocks is false', async () => {
|
||||
it('Should federate blocks if federateBlocks is true', async () => {
|
||||
const createBlock = (await import('../../src/services/blocking/create')).default;
|
||||
const deleteBlock = (await import('../../src/services/blocking/delete')).default;
|
||||
|
||||
|
@ -53,6 +54,6 @@ describe('Creating a block activity', () => {
|
|||
const spy = sinon.spy(queues, 'deliver');
|
||||
await createBlock(alice, carol);
|
||||
await deleteBlock(alice, carol);
|
||||
assert(spy.notCalled);
|
||||
assert(spy.calledTwice);
|
||||
});
|
||||
});
|
||||
|
|
33
yarn.lock
33
yarn.lock
|
@ -2180,6 +2180,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/mocha@npm:^10.0.0":
|
||||
version: 10.0.0
|
||||
resolution: "@types/mocha@npm:10.0.0"
|
||||
checksum: 69e3896a63ec93374e22afd03fdea4c2f31d609d6ea111c8403508ede90da9dc0140c7bb2edff8404114d9d980308e104e4236324bf6afac1410b2cfe35f98c6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node-fetch@npm:3.0.3":
|
||||
version: 3.0.3
|
||||
resolution: "@types/node-fetch@npm:3.0.3"
|
||||
|
@ -2405,6 +2412,22 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/sinon@npm:^10.0.13":
|
||||
version: 10.0.13
|
||||
resolution: "@types/sinon@npm:10.0.13"
|
||||
dependencies:
|
||||
"@types/sinonjs__fake-timers": "*"
|
||||
checksum: 46a14c888db50f0098ec53d451877e0111d878ec4a653b9e9ed7f8e54de386d6beb0e528ddc3e95cd3361a8ab9ad54e4cca33cd88d45b9227b83e9fc8fb6688a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/sinonjs__fake-timers@npm:*, @types/sinonjs__fake-timers@npm:8.1.2":
|
||||
version: 8.1.2
|
||||
resolution: "@types/sinonjs__fake-timers@npm:8.1.2"
|
||||
checksum: bbc73a5ab6c0ec974929392f3d6e1e8db4ebad97ec506d785301e1c3d8a4f98a35b1aa95b97035daef02886fd8efd7788a2fa3ced2ec7105988bfd8dce61eedd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/sinonjs__fake-timers@npm:8.1.1":
|
||||
version: 8.1.1
|
||||
resolution: "@types/sinonjs__fake-timers@npm:8.1.1"
|
||||
|
@ -2412,13 +2435,6 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/sinonjs__fake-timers@npm:8.1.2":
|
||||
version: 8.1.2
|
||||
resolution: "@types/sinonjs__fake-timers@npm:8.1.2"
|
||||
checksum: bbc73a5ab6c0ec974929392f3d6e1e8db4ebad97ec506d785301e1c3d8a4f98a35b1aa95b97035daef02886fd8efd7788a2fa3ced2ec7105988bfd8dce61eedd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/sizzle@npm:^2.3.2":
|
||||
version: 2.3.3
|
||||
resolution: "@types/sizzle@npm:2.3.3"
|
||||
|
@ -3677,7 +3693,7 @@ __metadata:
|
|||
"@types/koa__cors": 3.1.1
|
||||
"@types/koa__multer": 2.0.4
|
||||
"@types/koa__router": 8.0.11
|
||||
"@types/mocha": 9.1.1
|
||||
"@types/mocha": ^10.0.0
|
||||
"@types/node": 18.7.16
|
||||
"@types/node-fetch": 3.0.3
|
||||
"@types/nodemailer": 6.4.5
|
||||
|
@ -7899,6 +7915,7 @@ __metadata:
|
|||
dependencies:
|
||||
"@types/gulp": 4.0.9
|
||||
"@types/gulp-rename": 2.0.1
|
||||
"@types/sinon": ^10.0.13
|
||||
"@typescript-eslint/parser": ^5.36.2
|
||||
cross-env: 7.0.3
|
||||
cypress: 10.3.0
|
||||
|
|
Loading…
Add table
Reference in a new issue