mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-15 15:00:58 -05:00
domainAnnouncementsToShow -> domainAnnouncements
This commit is contained in:
parent
02e6eb4dd1
commit
cc717f0357
2 changed files with 3 additions and 8 deletions
|
@ -5,15 +5,10 @@ settings = require("settings-sharelatex")
|
||||||
async = require("async")
|
async = require("async")
|
||||||
_ = require("lodash")
|
_ = require("lodash")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = AnnouncementsHandler =
|
module.exports = AnnouncementsHandler =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_domainSpecificAnnouncements : (email)->
|
_domainSpecificAnnouncements : (email)->
|
||||||
domainSpecific = _.filter settings?.domainAnnouncementsToShow, (domainAnnouncment)->
|
domainSpecific = _.filter settings?.domainAnnouncements, (domainAnnouncment)->
|
||||||
matches = _.filter domainAnnouncment.domains, (domain)->
|
matches = _.filter domainAnnouncment.domains, (domain)->
|
||||||
return email.indexOf(domain) != -1
|
return email.indexOf(domain) != -1
|
||||||
return matches.length > 0 and domainAnnouncment.id?
|
return matches.length > 0 and domainAnnouncment.id?
|
||||||
|
|
|
@ -117,7 +117,7 @@ describe 'AnnouncementsHandler', ->
|
||||||
|
|
||||||
describe "_domainSpecificAnnouncements", ->
|
describe "_domainSpecificAnnouncements", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@settings.domainAnnouncementsToShow = [
|
@settings.domainAnnouncements = [
|
||||||
{
|
{
|
||||||
domains: ["gmail.com", 'yahoo.edu']
|
domains: ["gmail.com", 'yahoo.edu']
|
||||||
title: "some message"
|
title: "some message"
|
||||||
|
@ -150,7 +150,7 @@ describe 'AnnouncementsHandler', ->
|
||||||
|
|
||||||
|
|
||||||
it "should match on domain", (done) ->
|
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 = @handler._domainSpecificAnnouncements "someone@gmail.com"
|
||||||
result.length.should.equal 1
|
result.length.should.equal 1
|
||||||
result[0].id.should.equal "id1"
|
result[0].id.should.equal "id1"
|
||||||
|
|
Loading…
Reference in a new issue