mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-10 06:39:01 +02:00
domainAnnouncementsToShow -> domainAnnouncements
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user