Renamed members to post-gating for better context (#11309)

no issue

- Using members.js naming for the file was a bad choice and lead to some false signals when doing a cleanup.  `post-gating` is more explicit and to the point of what the module is responsible for
This commit is contained in:
Naz Gargol 2019-10-31 10:33:37 +01:00 committed by GitHub
parent 1fd7014c45
commit 0c3b90283a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 20 deletions

View File

@ -2,7 +2,7 @@ const _ = require('lodash');
const utils = require('../../../index');
const url = require('./url');
const date = require('./date');
const members = require('./members');
const gating = require('./post-gating');
const clean = require('./clean');
const extraAttrs = require('./extra-attrs');
const postsMetaSchema = require('../../../../../../data/schema').tables.posts_meta;
@ -43,7 +43,7 @@ const mapPost = (model, frame) => {
jsonModel.page = true;
}
date.forPost(jsonModel);
members.forPost(jsonModel, frame);
gating.forPost(jsonModel, frame);
}
clean.post(jsonModel, frame);

View File

@ -2,7 +2,7 @@ const _ = require('lodash');
const utils = require('../../../index');
const url = require('./url');
const date = require('./date');
const members = require('./members');
const gating = require('./post-gating');
const clean = require('./clean');
const extraAttrs = require('./extra-attrs');
const postsMetaSchema = require('../../../../../../data/schema').tables.posts_meta;
@ -45,7 +45,7 @@ const mapPost = (model, frame) => {
}
}
date.forPost(jsonModel);
members.forPost(jsonModel, frame);
gating.forPost(jsonModel, frame);
}
extraAttrs.forPost(frame, model, jsonModel);

View File

@ -1,9 +1,9 @@
const should = require('should');
const sinon = require('sinon');
const labs = require('../../../../../../../../server/services/labs');
const members = require('../../../../../../../../server/api/v2/utils/serializers/output/utils/members');
const gating = require('../../../../../../../../server/api/canary/utils/serializers/output/utils/post-gating');
describe('Unit: v2/utils/serializers/output/utils/members', function () {
describe('Unit: canary/utils/serializers/output/utils/post-gating', function () {
describe('for post', function () {
it('does not modify attributes when members is disabled', function () {
const attrs = {
@ -14,7 +14,7 @@ describe('Unit: v2/utils/serializers/output/utils/members', function () {
const frame = {
options: {}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('no touching');
});
@ -37,7 +37,7 @@ describe('Unit: v2/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('no touching');
});
@ -55,7 +55,7 @@ describe('Unit: v2/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('');
attrs.html.should.eql('');
@ -76,7 +76,7 @@ describe('Unit: v2/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('I see dead people');
attrs.html.should.eql('<p>What\'s the matter?</p>');
@ -101,7 +101,7 @@ describe('Unit: v2/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('');
attrs.html.should.eql('');
@ -126,7 +126,7 @@ describe('Unit: v2/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('Secret paid content');
attrs.html.should.eql('<p>Can read this</p>');

View File

@ -1,9 +1,9 @@
const should = require('should');
const sinon = require('sinon');
const labs = require('../../../../../../../../server/services/labs');
const members = require('../../../../../../../../server/api/canary/utils/serializers/output/utils/members');
const gating = require('../../../../../../../../server/api/v2/utils/serializers/output/utils/post-gating');
describe('Unit: canary/utils/serializers/output/utils/members', function () {
describe('Unit: v2/utils/serializers/output/utils/post-gating', function () {
describe('for post', function () {
it('does not modify attributes when members is disabled', function () {
const attrs = {
@ -14,7 +14,7 @@ describe('Unit: canary/utils/serializers/output/utils/members', function () {
const frame = {
options: {}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('no touching');
});
@ -37,7 +37,7 @@ describe('Unit: canary/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('no touching');
});
@ -55,7 +55,7 @@ describe('Unit: canary/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('');
attrs.html.should.eql('');
@ -76,7 +76,7 @@ describe('Unit: canary/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('I see dead people');
attrs.html.should.eql('<p>What\'s the matter?</p>');
@ -101,7 +101,7 @@ describe('Unit: canary/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('');
attrs.html.should.eql('');
@ -126,7 +126,7 @@ describe('Unit: canary/utils/serializers/output/utils/members', function () {
}
};
members.forPost(attrs, frame);
gating.forPost(attrs, frame);
attrs.plaintext.should.eql('Secret paid content');
attrs.html.should.eql('<p>Can read this</p>');