Skip to content

Commit

Permalink
Revert "fix(Analytics): log user correctly (#162)" (#163)
Browse files Browse the repository at this point in the history
This reverts commit 2f73945.
  • Loading branch information
jakebolam committed Mar 16, 2019
1 parent 2f73945 commit 97d35c8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ async function probotProcessIssueComment({ context, commentReply, analytics }) {
async function probotProcessIssueCommentSafe({ context }) {
const analytics = new Analytics({
...context.repo(),
user: context.payload.sender,
user: context.payload.sender.login,
log: context.log,
})
const commentReply = new CommentReply({ context })
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/trackInstall/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function getTrackName(action) {
async function trackInstall(payload) {
const analytics = new Analytics({
owner: payload.installation.account.login,
user: payload.sender,
user: payload.sender.login,
log: {
info: console.log, // eslint-disable-line no-console
error: console.error, // eslint-disable-line no-console
Expand Down
3 changes: 1 addition & 2 deletions src/utils/Analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ class Analytics {
}

const event = {
user_id: this.user.id,
user_id: this.user,
event_type: eventName,
user_properties: {
repo: this.repo,
owner: this.owner,
login: this.user.login,
},
event_properties: {
funnel_id: this.funnelId,
Expand Down
5 changes: 1 addition & 4 deletions test/utils/Analytics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ describe('Analytics', () => {
const analytics = new Analytics({
repo: 'all-contributors-bot',
owner: 'all-contributors',
user: {
login: 'mockusername',
id: 1234,
},
user: 'mockusername',
apiKey: 'mock api key',
funnelId: 'mockFunnelId',
isMock: true,
Expand Down
2 changes: 1 addition & 1 deletion test/utils/__snapshots__/Analytics.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
exports[`Analytics Analytics 1`] = `
Object {
"api_key": "mock api key",
"event": "[{\\"user_id\\":1234,\\"event_type\\":\\"my-event\\",\\"user_properties\\":{\\"repo\\":\\"all-contributors-bot\\",\\"owner\\":\\"all-contributors\\",\\"login\\":\\"mockusername\\"},\\"event_properties\\":{\\"funnel_id\\":\\"mockFunnelId\\"}}]",
"event": "[{\\"user_id\\":\\"mockusername\\",\\"event_type\\":\\"my-event\\",\\"user_properties\\":{\\"repo\\":\\"all-contributors-bot\\",\\"owner\\":\\"all-contributors\\"},\\"event_properties\\":{\\"funnel_id\\":\\"mockFunnelId\\"}}]",
}
`;

0 comments on commit 97d35c8

Please sign in to comment.