domainAnnouncementsToShow -> domainAnnouncements

This commit is contained in:
Henry Oswald 2017-01-25 09:43:42 +00:00
parent 02e6eb4dd1
commit cc717f0357
2 changed files with 3 additions and 8 deletions

View file

@ -5,15 +5,10 @@ settings = require("settings-sharelatex")
async = require("async")
_ = require("lodash")
module.exports = AnnouncementsHandler =
_domainSpecificAnnouncements : (email)->
domainSpecific = _.filter settings?.domainAnnouncementsToShow, (domainAnnouncment)->
domainSpecific = _.filter settings?.domainAnnouncements, (domainAnnouncment)->
matches = _.filter domainAnnouncment.domains, (domain)->
return email.indexOf(domain) != -1
return matches.length > 0 and domainAnnouncment.id?

View file

@ -117,7 +117,7 @@ describe 'AnnouncementsHandler', ->
describe "_domainSpecificAnnouncements", ->
beforeEach ->
@settings.domainAnnouncementsToShow = [
@settings.domainAnnouncements = [
{
domains: ["gmail.com", 'yahoo.edu']
title: "some message"
@ -150,7 +150,7 @@ describe 'AnnouncementsHandler', ->
it "should match on domain", (done) ->
@settings.domainAnnouncementsToShow[2].domains = ["yahoo.com"]
@settings.domainAnnouncements[2].domains = ["yahoo.com"]
result = @handler._domainSpecificAnnouncements "someone@gmail.com"
result.length.should.equal 1
result[0].id.should.equal "id1"