Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
99a991ad
Commit
99a991ad
authored
Sep 01, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
27e90be2
94533788
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
10 deletions
+39
-10
changelogs/unreleased/232839-fj-track-unique-edit-web-ide-action.yml
...unreleased/232839-fj-track-unique-edit-web-ide-action.yml
+5
-0
doc/administration/reference_architectures/2k_users.md
doc/administration/reference_architectures/2k_users.md
+2
-2
doc/administration/reference_architectures/3k_users.md
doc/administration/reference_architectures/3k_users.md
+2
-2
doc/administration/reference_architectures/5k_users.md
doc/administration/reference_architectures/5k_users.md
+2
-2
lib/api/commits.rb
lib/api/commits.rb
+4
-1
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+24
-3
No files found.
changelogs/unreleased/232839-fj-track-unique-edit-web-ide-action.yml
0 → 100644
View file @
99a991ad
---
title
:
Track unique web ide edit action for usage ping
merge_request
:
40246
author
:
type
:
changed
doc/administration/reference_architectures/2k_users.md
View file @
99a991ad
...
...
@@ -405,7 +405,7 @@ To configure the Gitaly server:
# to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API.
# The following two values must be the same as their respective values
# of the GitLab Rails application setup
gitaly
[
'auth_token'
]
=
'git
la
ysecret'
gitaly
[
'auth_token'
]
=
'git
al
ysecret'
gitlab_shell
[
'secret_token'
]
=
'shellsecret'
# Avoid running unnecessary services on the Gitaly server
...
...
@@ -586,7 +586,7 @@ On each node perform the following:
# to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API.
# The following two values must be the same as their respective values
# of the Gitaly setup
gitlab_rails
[
'gitaly_token'
]
=
'gitalyecret'
gitlab_rails
[
'gitaly_token'
]
=
'gitaly
s
ecret'
gitlab_shell
[
'secret_token'
]
=
'shellsecret'
git_data_dirs
({
...
...
doc/administration/reference_architectures/3k_users.md
View file @
99a991ad
...
...
@@ -1131,7 +1131,7 @@ On each node:
# to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API.
# The following two values must be the same as their respective values
# of the GitLab Rails application setup
gitaly
[
'auth_token'
]
=
'git
la
ysecret'
gitaly
[
'auth_token'
]
=
'git
al
ysecret'
gitlab_shell
[
'secret_token'
]
=
'shellsecret'
# Avoid running unnecessary services on the Gitaly server
...
...
@@ -1474,7 +1474,7 @@ On each node perform the following:
# to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API.
# The following two values must be the same as their respective values
# of the Gitaly setup
gitlab_rails
[
'gitaly_token'
]
=
'gitalyecret'
gitlab_rails
[
'gitaly_token'
]
=
'gitaly
s
ecret'
gitlab_shell
[
'secret_token'
]
=
'shellsecret'
git_data_dirs
({
...
...
doc/administration/reference_architectures/5k_users.md
View file @
99a991ad
...
...
@@ -1130,7 +1130,7 @@ On each node:
# to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API.
# The following two values must be the same as their respective values
# of the GitLab Rails application setup
gitaly
[
'auth_token'
]
=
'git
la
ysecret'
gitaly
[
'auth_token'
]
=
'git
al
ysecret'
gitlab_shell
[
'secret_token'
]
=
'shellsecret'
# Avoid running unnecessary services on the Gitaly server
...
...
@@ -1473,7 +1473,7 @@ On each node perform the following:
# to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API.
# The following two values must be the same as their respective values
# of the Gitaly setup
gitlab_rails
[
'gitaly_token'
]
=
'gitalyecret'
gitlab_rails
[
'gitaly_token'
]
=
'gitaly
s
ecret'
gitlab_shell
[
'secret_token'
]
=
'shellsecret'
git_data_dirs
({
...
...
lib/api/commits.rb
View file @
99a991ad
...
...
@@ -136,7 +136,10 @@ module API
if
result
[
:status
]
==
:success
commit_detail
=
user_project
.
repository
.
commit
(
result
[
:result
])
Gitlab
::
UsageDataCounters
::
WebIdeCounter
.
increment_commits_count
if
find_user_from_warden
if
find_user_from_warden
Gitlab
::
UsageDataCounters
::
WebIdeCounter
.
increment_commits_count
Gitlab
::
UsageDataCounters
::
EditorUniqueCounter
.
track_web_ide_edit_action
(
author:
current_user
)
end
present
commit_detail
,
with:
Entities
::
CommitDetail
,
stats:
params
[
:stats
]
else
...
...
spec/requests/api/commits_spec.rb
View file @
99a991ad
...
...
@@ -367,10 +367,31 @@ RSpec.describe API::Commits do
end
end
it
'does not increment the usage counters using access token authentication'
do
expect
(
::
Gitlab
::
UsageDataCounters
::
WebIdeCounter
).
not_to
receive
(
:increment_commits_count
)
context
'when using access token authentication'
do
it
'does not increment the usage counters'
do
expect
(
::
Gitlab
::
UsageDataCounters
::
WebIdeCounter
).
not_to
receive
(
:increment_commits_count
)
expect
(
::
Gitlab
::
UsageDataCounters
::
EditorUniqueCounter
).
not_to
receive
(
:track_web_ide_edit_action
)
post
api
(
url
,
user
),
params:
valid_c_params
post
api
(
url
,
user
),
params:
valid_c_params
end
end
context
'when using warden'
do
it
'increments usage counters'
,
:clean_gitlab_redis_shared_state
do
session_id
=
Rack
::
Session
::
SessionId
.
new
(
'6919a6f1bb119dd7396fadc38fd18d0d'
)
session_hash
=
{
'warden.user.user.key'
=>
[[
user
.
id
],
user
.
encrypted_password
[
0
,
29
]]
}
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
redis
.
set
(
"session:gitlab:
#{
session_id
.
private_id
}
"
,
Marshal
.
dump
(
session_hash
))
end
cookies
[
Gitlab
::
Application
.
config
.
session_options
[
:key
]]
=
session_id
.
public_id
expect
(
::
Gitlab
::
UsageDataCounters
::
WebIdeCounter
).
to
receive
(
:increment_commits_count
)
expect
(
::
Gitlab
::
UsageDataCounters
::
EditorUniqueCounter
).
to
receive
(
:track_web_ide_edit_action
)
post
api
(
url
),
params:
valid_c_params
end
end
context
'a new file in project repo'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment