mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -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")
|
||||
_ = 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?
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue