mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-03 00:15:11 +03:00
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:
parent
1fd7014c45
commit
0c3b90283a
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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>');
|
@ -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>');
|
Loading…
Reference in New Issue
Block a user