Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit e5ec5f4

Browse files
committed
Remove everything related to the blacklist
1 parent 719a303 commit e5ec5f4

File tree

13 files changed

+14
-388
lines changed

13 files changed

+14
-388
lines changed

features/api/usersettings/blacklist.feature

Lines changed: 0 additions & 43 deletions
This file was deleted.

features/step_definitions/steps.js

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ let currentUserPassword;
1212
let httpResponse;
1313
let currentUserAccessToken;
1414
let lastPost;
15-
let blacklistedUser;
1615

1716
function authenticate(email, plainTextPassword) {
1817
const formData = {
@@ -131,34 +130,6 @@ When('you create your user settings via POST request to {string} with:', functio
131130
postRequest(route, JSON.stringify(jsonBody), callback);
132131
});
133132

134-
Then('you will stop seeing posts of the user with id {string}', function (blacklistedUserId) {
135-
return this.app.service('usersettings').find({userId: currentUser._id.toString()}).then((settings) => {
136-
expect(settings.total).to.eq(1);
137-
expect(settings.data[0].blacklist).to.be.an('array').that.does.include(blacklistedUserId);
138-
});
139-
});
140-
141-
Given('you blacklisted the user {string} before', async function (blacklistedUserName) {
142-
const res = await this.app.service('users').find({query: {name: blacklistedUserName}});
143-
blacklistedUser = res.data[0];
144-
const params = {
145-
userId: currentUser._id,
146-
blacklist: [blacklistedUser._id]
147-
};
148-
return this.app.service('usersettings').create(params);
149-
});
150-
151-
When('this user publishes a post', function () {
152-
const params = {
153-
title: 'Awful title',
154-
content: 'disgusting content',
155-
language: 'en',
156-
type: 'post',
157-
userId: blacklistedUser._id
158-
};
159-
return this.app.service('contributions').create(params);
160-
});
161-
162133
When('you read your current news feed', function (callback) {
163134
getRequest('/contributions', callback);
164135
});
@@ -181,15 +152,6 @@ Given('there is a post {string} by user {string}', async function (postTitle, us
181152
return lastPost;
182153
});
183154

184-
Given('the blacklisted user wrote a comment on that post:', function (comment) {
185-
const commentParams = {
186-
userId: blacklistedUser._id,
187-
content: comment,
188-
contributionId: lastPost._id
189-
};
190-
return this.app.service('comments').create(commentParams);
191-
});
192-
193155
When('you read through the comments of that post', function (callback) {
194156
getRequest('/comments', callback);
195157
});

server/hooks/conceal-blacklisted-data.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

server/hooks/exclude-blacklisted.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

server/models/usersettings.model.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ module.exports = function (app) {
77
const mongooseClient = app.get('mongooseClient');
88
const usersettings = new mongooseClient.Schema({
99
userId: {type: String, required: true, unique: true},
10-
blacklist: {type: Array, default: []},
1110
uiLanguage: {type: String, required: true},
1211
contentLanguages: {type: Array, default: []},
1312
filter: {

server/services/comments/comments.hooks.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const {
1010
const { isVerified } = require('feathers-authentication-management').hooks;
1111
const createExcerpt = require('../../hooks/create-excerpt');
1212
const patchDeletedData = require('../../hooks/patch-deleted-data');
13-
const concealBlacklistedData = require('../../hooks/conceal-blacklisted-data');
1413
const keepDeletedDataFields = require('../../hooks/keep-deleted-data-fields');
1514
const createNotifications = require('./hooks/create-notifications');
1615
const createMentionNotifications = require('./hooks/create-mention-notifications');
@@ -119,24 +118,10 @@ module.exports = {
119118
],
120119
find: [
121120
populate({ schema: userSchema }),
122-
protect('content', 'badgeIds'),
123-
concealBlacklistedData({
124-
data: {
125-
content: 'Comments of this blacklisted user are not visible.',
126-
contentExcerpt: 'Comments of this blacklisted user are not visible.',
127-
hasMore: false
128-
}
129-
})
121+
protect('content', 'badgeIds')
130122
],
131123
get: [
132-
populate({ schema: userSchema }),
133-
concealBlacklistedData({
134-
data: {
135-
content: 'Comments of this blacklisted user are not visible.',
136-
contentExcerpt: 'Comments of this blacklisted user are not visible.',
137-
hasMore: false
138-
}
139-
})
124+
populate({ schema: userSchema })
140125
],
141126
create: [
142127
populate({ schema: userSchema }),

server/services/contributions/contributions.hooks.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const search = require('feathers-mongodb-fuzzy-search');
1717
const thumbnails = require('../../hooks/thumbnails');
1818
const isModerator = require('../../hooks/is-moderator-boolean');
1919
const excludeDisabled = require('../../hooks/exclude-disabled');
20-
const excludeBlacklisted = require('../../hooks/exclude-blacklisted');
2120
const getAssociatedCanDos = require('./hooks/get-associated-can-dos');
2221
const createMentionNotifications = require('./hooks/create-mention-notifications');
2322
const notifyFollowers = require('./hooks/notify-followers');
@@ -114,7 +113,6 @@ module.exports = {
114113
unless(isModerator(),
115114
excludeDisabled()
116115
),
117-
excludeBlacklisted(),
118116
when(isProvider('server'),
119117
includeAll()
120118
),

server/services/usersettings/hooks/validate-blacklist.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

server/services/usersettings/usersettings.hooks.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const { restrictToOwner } = require('feathers-authentication-hooks');
22
const mapCreateToUpsert = require('../../hooks/map-create-to-upsert');
3-
const validateBlacklist = require('./hooks/validate-blacklist');
43
const { authenticate } = require('@feathersjs/authentication').hooks;
54

65
module.exports = {
@@ -10,25 +9,21 @@ module.exports = {
109
get: [],
1110
create: [
1211
authenticate('jwt'),
13-
validateBlacklist(),
1412
mapCreateToUpsert(context => {
1513
const { data } = context;
1614
return { userId: data.userId };
1715
})
1816
],
1917
update: [
2018
authenticate('jwt'),
21-
validateBlacklist(),
2219
restrictToOwner()
2320
],
2421
patch: [
2522
authenticate('jwt'),
26-
validateBlacklist(),
2723
restrictToOwner()
2824
],
2925
remove: [
3026
authenticate('jwt'),
31-
validateBlacklist(),
3227
restrictToOwner()
3328
]
3429
},

test/hooks/exclude-blacklisted.test.js

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)