Update analytics manager to use new path

It fixes a typo in the path.

Related to https://github.com/sharelatex/analytics-sharelatex/pull/43
This commit is contained in:
Alberto Fernández Capel 2018-02-07 09:33:28 +00:00
parent e93e055b13
commit 413e81f29a
4 changed files with 12 additions and 12 deletions

View file

@ -55,14 +55,14 @@ module.exports =
makeRequest opts, callback
getLastOccurance: (user_id, event, callback = (error) ->) ->
getLastOccurrence: (user_id, event, callback = (error) ->) ->
opts =
body:
event:event
json:true
method:"POST"
timeout:1000
url: "/user/#{user_id}/event/last_occurnace"
url: "/user/#{user_id}/event/last_occurrence"
makeRequest opts, (err, response, body)->
if err?
console.log response, opts

View file

@ -24,7 +24,7 @@ module.exports = AnnouncementsHandler =
async.parallel {
lastEvent: (cb)->
AnalyticsManager.getLastOccurance user._id, "announcement-alert-dismissed", cb
AnalyticsManager.getLastOccurrence user._id, "announcement-alert-dismissed", cb
announcements: (cb)->
BlogHandler.getLatestAnnouncements cb
}, (err, results)->

View file

@ -14,7 +14,7 @@ describe 'AnnouncementsHandler', ->
_id:"3c6afe000000000000000000" #2002-02-14T00:00:00.000Z
email: "someone@gmail.com"
@AnalyticsManager =
getLastOccurance: sinon.stub()
getLastOccurrence: sinon.stub()
@BlogHandler =
getLatestAnnouncements:sinon.stub()
@settings = {}
@ -46,7 +46,7 @@ describe 'AnnouncementsHandler', ->
it "should mark all announcements as read is false", (done)->
@AnalyticsManager.getLastOccurance.callsArgWith(2, null, [])
@AnalyticsManager.getLastOccurrence.callsArgWith(2, null, [])
@handler.getUnreadAnnouncements @user, (err, announcements)=>
announcements[0].read.should.equal false
announcements[1].read.should.equal false
@ -55,7 +55,7 @@ describe 'AnnouncementsHandler', ->
done()
it "should should be sorted again to ensure correct order", (done)->
@AnalyticsManager.getLastOccurance.callsArgWith(2, null, [])
@AnalyticsManager.getLastOccurrence.callsArgWith(2, null, [])
@handler.getUnreadAnnouncements @user, (err, announcements)=>
announcements[3].should.equal @stubbedAnnouncements[2]
announcements[2].should.equal @stubbedAnnouncements[3]
@ -64,7 +64,7 @@ describe 'AnnouncementsHandler', ->
done()
it "should return older ones marked as read as well", (done)->
@AnalyticsManager.getLastOccurance.callsArgWith(2, null, {segmentation:{blogPostId:"/2008/04/12/title-date-irrelivant"}})
@AnalyticsManager.getLastOccurrence.callsArgWith(2, null, {segmentation:{blogPostId:"/2008/04/12/title-date-irrelivant"}})
@handler.getUnreadAnnouncements @user, (err, announcements)=>
announcements[0].id.should.equal @stubbedAnnouncements[0].id
announcements[0].read.should.equal false
@ -81,7 +81,7 @@ describe 'AnnouncementsHandler', ->
done()
it "should return all of them marked as read", (done)->
@AnalyticsManager.getLastOccurance.callsArgWith(2, null, {segmentation:{blogPostId:"/2016/11/01/introducting-latex-code-checker"}})
@AnalyticsManager.getLastOccurrence.callsArgWith(2, null, {segmentation:{blogPostId:"/2016/11/01/introducting-latex-code-checker"}})
@handler.getUnreadAnnouncements @user, (err, announcements)=>
announcements[0].read.should.equal true
announcements[1].read.should.equal true
@ -94,7 +94,7 @@ describe 'AnnouncementsHandler', ->
date: new Date(978836800000),
id: '/2001/04/12/title-date-irrelivant'
})
@AnalyticsManager.getLastOccurance.callsArgWith(2, null, [])
@AnalyticsManager.getLastOccurrence.callsArgWith(2, null, [])
@handler.getUnreadAnnouncements @user, (err, announcements)=>
announcements[0].read.should.equal false
announcements[1].read.should.equal false
@ -121,7 +121,7 @@ describe 'AnnouncementsHandler', ->
@handler._domainSpecificAnnouncements = sinon.stub().returns(@stubbedDomainSpecificAnn)
it "should insert the domain specific in the correct place", (done)->
@AnalyticsManager.getLastOccurance.callsArgWith(2, null, [])
@AnalyticsManager.getLastOccurrence.callsArgWith(2, null, [])
@handler.getUnreadAnnouncements @user, (err, announcements)=>
announcements[4].should.equal @stubbedAnnouncements[2]
announcements[3].should.equal @stubbedAnnouncements[3]

View file

@ -60,7 +60,7 @@ describe "ProjectController", ->
getSessionUser: sinon.stub().returns(@user)
isUserLoggedIn: sinon.stub().returns(true)
@AnalyticsManager =
getLastOccurance: sinon.stub()
getLastOccurrence: sinon.stub()
@TokenAccessHandler =
getRequestToken: sinon.stub().returns(@token)
protectTokens: sinon.stub()
@ -445,7 +445,7 @@ describe "ProjectController", ->
@AuthorizationManager.getPrivilegeLevelForProject.callsArgWith 3, null, "owner"
@ProjectDeleter.unmarkAsDeletedByExternalSource = sinon.stub()
@InactiveProjectManager.reactivateProjectIfRequired.callsArgWith(1)
@AnalyticsManager.getLastOccurance.yields(null, {"mock": "event"})
@AnalyticsManager.getLastOccurrence.yields(null, {"mock": "event"})
@ProjectUpdateHandler.markAsOpened.callsArgWith(1)
it "should render the project/editor page", (done)->