Merge pull request #3581 from overleaf/jel-dash-consolidate-emails-requests

Consolidate emails requests on the dashboard

GitOrigin-RevId: acfaf92dee257712e1eb3ffbf75b536fd1619e1d
This commit is contained in:
Jessica Lawshe
2021-02-02 08:26:10 -06:00
committed by Copybot
parent 2c200d9e76
commit 2dd860c431
9 changed files with 67 additions and 83 deletions
@@ -114,18 +114,6 @@ describe('ProjectController', function() {
this.TpdsProjectFlusher = {
flushProjectToTpdsIfNeeded: sinon.stub().yields()
}
this.getUserAffiliations = sinon.stub().callsArgWith(1, null, [
{
email: 'test@overleaf.com',
institution: {
id: 1,
confirmed: true,
name: 'Overleaf',
ssoBeta: false,
ssoEnabled: true
}
}
])
this.Metrics = {
Timer: class {
done() {}
@@ -173,9 +161,6 @@ describe('ProjectController', function() {
'../User/UserGetter': this.UserGetter,
'../BrandVariations/BrandVariationsHandler': this
.BrandVariationsHandler,
'../Institutions/InstitutionsAPI': {
getUserAffiliations: this.getUserAffiliations
},
'../ThirdPartyDataStore/TpdsProjectFlusher': this.TpdsProjectFlusher,
'../../models/Project': {},
'../Analytics/AnalyticsManager': { recordEvent: () => {} },
@@ -526,15 +511,6 @@ describe('ProjectController', function() {
this.ProjectController.projectListPage(this.req, this.res)
})
it('should show a warning when there is an error getting affiliations from v1', function(done) {
this.getUserAffiliations.yields(new Errors.V1ConnectionError('error'))
this.res.render = (pageName, opts) => {
expect(opts.warnings).to.contain(this.connectionWarning)
done()
}
this.ProjectController.projectListPage(this.req, this.res)
})
it('should show a warning when there is an error getting full emails due to v1', function(done) {
this.UserGetter.getUserFullEmails.yields(
new Errors.V1ConnectionError('error')
@@ -597,6 +573,20 @@ describe('ProjectController', function() {
done()
})
it('should show institution SSO available notification for confirmed domains', function() {
this.UserGetter.getUserFullEmails.yields(null, [
{
email: 'test@overleaf.com',
affiliation: {
institution: {
id: 1,
confirmed: true,
name: 'Overleaf',
ssoBeta: false,
ssoEnabled: true
}
}
}
])
this.res.render = (pageName, opts) => {
expect(opts.notificationsInstitution).to.deep.include({
email: this.institutionEmail,
@@ -713,15 +703,17 @@ describe('ProjectController', function() {
})
describe('for an unconfirmed domain for an SSO institution', function() {
beforeEach(function(done) {
this.getUserAffiliations.yields(null, [
this.UserGetter.getUserFullEmails.yields(null, [
{
email: 'test@overleaf-uncofirmed.com',
institution: {
id: 1,
confirmed: false,
name: 'Overleaf',
ssoBeta: false,
ssoEnabled: true
affiliation: {
institution: {
id: 1,
confirmed: false,
name: 'Overleaf',
ssoBeta: false,
ssoEnabled: true
}
}
}
])
@@ -758,15 +750,17 @@ describe('ProjectController', function() {
})
describe('Institution with SSO beta testable', function() {
beforeEach(function(done) {
this.getUserAffiliations.yields(null, [
this.UserGetter.getUserFullEmails.yields(null, [
{
email: 'beta@beta.com',
institution: {
id: 2,
confirmed: true,
name: 'Beta University',
ssoBeta: true,
ssoEnabled: false
affiliation: {
institution: {
id: 2,
confirmed: true,
name: 'Beta University',
ssoBeta: true,
ssoEnabled: false
}
}
}
])