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
2ad00f52
Commit
2ad00f52
authored
Feb 15, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tweet-new-project'
Conflicts: db/schema.rb
parents
26d594f2
67afb5b1
Changes
27
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
236 additions
and
151 deletions
+236
-151
CHANGELOG
CHANGELOG
+1
-0
app/assets/stylesheets/sections/events.scss
app/assets/stylesheets/sections/events.scss
+4
-0
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+1
-0
app/controllers/projects/tags_controller.rb
app/controllers/projects/tags_controller.rb
+1
-1
app/helpers/application_settings_helper.rb
app/helpers/application_settings_helper.rb
+4
-0
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+32
-21
app/models/application_setting.rb
app/models/application_setting.rb
+2
-0
app/models/event.rb
app/models/event.rb
+53
-54
app/models/members/project_member.rb
app/models/members/project_member.rb
+10
-13
app/services/create_branch_service.rb
app/services/create_branch_service.rb
+1
-1
app/services/create_tag_service.rb
app/services/create_tag_service.rb
+1
-1
app/services/delete_branch_service.rb
app/services/delete_branch_service.rb
+1
-1
app/services/event_create_service.rb
app/services/event_create_service.rb
+56
-16
app/services/git_push_service.rb
app/services/git_push_service.rb
+1
-10
app/services/git_tag_push_service.rb
app/services/git_tag_push_service.rb
+1
-10
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+5
-7
app/views/admin/application_settings/_form.html.haml
app/views/admin/application_settings/_form.html.haml
+5
-0
app/views/events/_event.html.haml
app/views/events/_event.html.haml
+4
-2
app/views/events/event/_common.html.haml
app/views/events/event/_common.html.haml
+6
-4
app/views/events/event/_created_project.html.haml
app/views/events/event/_created_project.html.haml
+27
-0
app/views/events/event/_note.html.haml
app/views/events/event/_note.html.haml
+5
-1
app/views/events/event/_push.html.haml
app/views/events/event/_push.html.haml
+1
-1
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-0
db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb
...43_add_twitter_sharing_enabled_to_application_settings.rb
+5
-0
features/dashboard/dashboard.feature
features/dashboard/dashboard.feature
+2
-2
features/steps/dashboard/dashboard.rb
features/steps/dashboard/dashboard.rb
+4
-4
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+2
-2
No files found.
CHANGELOG
View file @
2ad00f52
...
...
@@ -53,6 +53,7 @@ v 7.8.0 (unreleased)
- Show assignees in merge request index page (Kelvin Mutuma)
- Link head panel titles to relevant root page.
- Allow users that signed up via OAuth to set their password in order to use Git over HTTP(S).
- Show users button to share their newly created public or internal projects on twitter
v 7.7.2
- Update GitLab Shell to version 2.4.2 that fixes a bug when developers can push to protected branch
...
...
app/assets/stylesheets/sections/events.scss
View file @
2ad00f52
...
...
@@ -64,6 +64,10 @@
.md
{
font-size
:
13px
;
iframe
.twitter-share-button
{
vertical-align
:
bottom
;
}
}
pre
{
...
...
app/controllers/admin/application_settings_controller.rb
View file @
2ad00f52
...
...
@@ -26,6 +26,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:signup_enabled
,
:signin_enabled
,
:gravatar_enabled
,
:twitter_sharing_enabled
,
:sign_in_text
,
:home_page_url
)
...
...
app/controllers/projects/tags_controller.rb
View file @
2ad00f52
...
...
@@ -27,7 +27,7 @@ class Projects::TagsController < Projects::ApplicationController
tag
=
@repository
.
find_tag
(
params
[
:id
])
if
tag
&&
@repository
.
rm_tag
(
tag
.
name
)
Event
.
create_ref_event
(
@project
,
current_user
,
tag
,
'rm'
,
'refs/tags'
)
Event
CreateService
.
new
.
push_ref
(
@project
,
current_user
,
tag
,
'rm'
,
'refs/tags'
)
end
respond_to
do
|
format
|
...
...
app/helpers/application_settings_helper.rb
View file @
2ad00f52
...
...
@@ -3,6 +3,10 @@ module ApplicationSettingsHelper
current_application_settings
.
gravatar_enabled?
end
def
twitter_sharing_enabled?
current_application_settings
.
twitter_sharing_enabled?
end
def
signup_enabled?
current_application_settings
.
signup_enabled?
end
...
...
app/helpers/events_helper.rb
View file @
2ad00f52
...
...
@@ -11,7 +11,11 @@ module EventsHelper
def
event_action_name
(
event
)
target
=
if
event
.
target_type
if
event
.
note?
event
.
note_target_type
else
event
.
target_type
.
titleize
.
downcase
end
else
'project'
end
...
...
@@ -42,21 +46,30 @@ module EventsHelper
end
def
event_feed_title
(
event
)
if
event
.
issue?
"
#{
event
.
author_name
}
#{
event
.
action_name
}
issue #
#{
event
.
target_iid
}
:
#{
event
.
issue_title
}
at
#{
event
.
project_name
}
"
elsif
event
.
merge_request?
"
#{
event
.
author_name
}
#{
event
.
action_name
}
MR #
#{
event
.
target_iid
}
:
#{
event
.
merge_request_title
}
at
#{
event
.
project_name
}
"
elsif
event
.
push?
"
#{
event
.
author_name
}
#{
event
.
push_action_name
}
#{
event
.
ref_type
}
#{
event
.
ref_name
}
at
#{
event
.
project_name
}
"
elsif
event
.
membership_changed?
"
#{
event
.
author_name
}
#{
event
.
action_name
}
#{
event
.
project_name
}
"
elsif
event
.
note?
&&
event
.
note_commit?
"
#{
event
.
author_name
}
commented on
#{
event
.
note_target_type
}
#{
event
.
note_short_commit_id
}
at
#{
event
.
project_name
}
"
elsif
event
.
note?
"
#{
event
.
author_name
}
commented on
#{
event
.
note_target_type
}
#
#{
truncate
event
.
note_target_iid
}
at
#{
event
.
project_name
}
"
words
=
[]
words
<<
event
.
author_name
words
<<
event_action_name
(
event
)
if
event
.
push?
words
<<
event
.
ref_type
words
<<
event
.
ref_name
words
<<
"at"
elsif
event
.
commented?
if
event
.
note_commit?
words
<<
event
.
note_short_commit_id
else
""
words
<<
"#
#{
truncate
event
.
note_target_iid
}
"
end
words
<<
"at"
elsif
event
.
target
words
<<
"#
#{
event
.
target_iid
}
:"
words
<<
event
.
target
.
title
if
event
.
target
.
respond_to?
(
:title
)
words
<<
"at"
end
words
<<
event
.
project_name
words
.
join
(
" "
)
end
def
event_feed_url
(
event
)
...
...
@@ -96,8 +109,6 @@ module EventsHelper
render
"events/event_push"
,
event:
event
elsif
event
.
merge_request?
render
"events/event_merge_request"
,
merge_request:
event
.
merge_request
elsif
event
.
push?
render
"events/event_push"
,
event:
event
elsif
event
.
note?
render
"events/event_note"
,
note:
event
.
note
end
...
...
app/models/application_setting.rb
View file @
2ad00f52
...
...
@@ -8,6 +8,7 @@
# signup_enabled :boolean
# signin_enabled :boolean
# gravatar_enabled :boolean
# twitter_sharing_enabled :boolean
# sign_in_text :text
# created_at :datetime
# updated_at :datetime
...
...
@@ -30,6 +31,7 @@ class ApplicationSetting < ActiveRecord::Base
default_branch_protection:
Settings
.
gitlab
[
'default_branch_protection'
],
signup_enabled:
Settings
.
gitlab
[
'signup_enabled'
],
signin_enabled:
Settings
.
gitlab
[
'signin_enabled'
],
twitter_sharing_enabled:
Settings
.
gitlab
[
'twitter_sharing_enabled'
],
gravatar_enabled:
Settings
.
gravatar
[
'enabled'
],
sign_in_text:
Settings
.
extra
[
'sign_in_text'
],
)
...
...
app/models/event.rb
View file @
2ad00f52
...
...
@@ -49,29 +49,6 @@ class Event < ActiveRecord::Base
scope
:in_projects
,
->
(
project_ids
)
{
where
(
project_id:
project_ids
).
recent
}
class
<<
self
def
create_ref_event
(
project
,
user
,
ref
,
action
=
'add'
,
prefix
=
'refs/heads'
)
commit
=
project
.
repository
.
commit
(
ref
.
target
)
if
action
.
to_s
==
'add'
before
=
'00000000'
after
=
commit
.
id
else
before
=
commit
.
id
after
=
'00000000'
end
Event
.
create
(
project:
project
,
action:
Event
::
PUSHED
,
data:
{
ref:
"
#{
prefix
}
/
#{
ref
.
name
}
"
,
before:
before
,
after:
after
},
author_id:
user
.
id
)
end
def
reset_event_cache_for
(
target
)
Event
.
where
(
target_id:
target
.
id
,
target_type:
target
.
class
.
to_s
).
order
(
'id DESC'
).
limit
(
100
).
...
...
@@ -84,6 +61,8 @@ class Event < ActiveRecord::Base
true
elsif
membership_changed?
true
elsif
created_project?
true
else
(
issue?
||
merge_request?
||
note?
||
milestone?
)
&&
target
end
...
...
@@ -98,25 +77,51 @@ class Event < ActiveRecord::Base
end
def
target_title
if
target
&&
target
.
respond_to?
(
:title
)
target
.
title
target
.
title
if
target
&&
target
.
respond_to?
(
:title
)
end
def
created?
action
==
CREATED
end
def
push?
action
==
self
.
class
::
PUSHED
&&
valid_push?
action
==
PUSHED
&&
valid_push?
end
def
merged?
action
==
self
.
class
::
MERGED
action
==
MERGED
end
def
closed?
action
==
self
.
class
::
CLOSED
action
==
CLOSED
end
def
reopened?
action
==
self
.
class
::
REOPENED
action
==
REOPENED
end
def
joined?
action
==
JOINED
end
def
left?
action
==
LEFT
end
def
commented?
action
==
COMMENTED
end
def
membership_changed?
joined?
||
left?
end
def
created_project?
created?
&&
!
target
end
def
created_target?
created?
&&
target
end
def
milestone?
...
...
@@ -135,32 +140,32 @@ class Event < ActiveRecord::Base
target_type
==
"MergeRequest"
end
def
joined?
action
==
JOINED
end
def
left?
action
==
LEFT
end
def
membership_changed?
joined?
||
left?
def
milestone
target
if
milestone?
end
def
issue
target
if
target_type
==
"Issue"
target
if
issue?
end
def
merge_request
target
if
target_type
==
"MergeRequest"
target
if
merge_request?
end
def
note
target
if
target_type
==
"Note"
target
if
note?
end
def
action_name
if
closed?
if
push?
if
new_ref?
"pushed new"
elsif
rm_ref?
"deleted"
else
"pushed to"
end
elsif
closed?
"closed"
elsif
merged?
"accepted"
...
...
@@ -168,6 +173,10 @@ class Event < ActiveRecord::Base
'joined'
elsif
left?
'left'
elsif
commented?
"commented on"
elsif
created_project?
"created"
else
"opened"
end
...
...
@@ -236,16 +245,6 @@ class Event < ActiveRecord::Base
tag?
?
"tag"
:
"branch"
end
def
push_action_name
if
new_ref?
"pushed new"
elsif
rm_ref?
"deleted"
else
"pushed to"
end
end
def
push_with_commits?
md_ref?
&&
commits
.
any?
&&
commit_from
&&
commit_to
end
...
...
app/models/members/project_member.rb
View file @
2ad00f52
...
...
@@ -114,13 +114,11 @@ class ProjectMember < Member
end
def
post_create_hook
Event
.
create
(
project_id:
self
.
project
.
id
,
action:
Event
::
JOINED
,
author_id:
self
.
user
.
id
)
unless
owner?
event_service
.
join_project
(
self
.
project
,
self
.
user
)
notification_service
.
new_team_member
(
self
)
end
notification_service
.
new_team_member
(
self
)
unless
owner?
system_hook_service
.
execute_hooks_for
(
self
,
:create
)
end
...
...
@@ -129,15 +127,14 @@ class ProjectMember < Member
end
def
post_destroy_hook
Event
.
create
(
project_id:
self
.
project
.
id
,
action:
Event
::
LEFT
,
author_id:
self
.
user
.
id
)
event_service
.
leave_project
(
self
.
project
,
self
.
user
)
system_hook_service
.
execute_hooks_for
(
self
,
:destroy
)
end
def
event_service
EventCreateService
.
new
end
def
notification_service
NotificationService
.
new
end
...
...
app/services/create_branch_service.rb
View file @
2ad00f52
...
...
@@ -17,7 +17,7 @@ class CreateBranchService < BaseService
new_branch
=
repository
.
find_branch
(
branch_name
)
if
new_branch
Event
.
create_ref_event
(
project
,
current_user
,
new_branch
,
'add'
)
Event
CreateService
.
new
.
push_ref
(
project
,
current_user
,
new_branch
,
'add'
)
return
success
(
new_branch
)
else
return
error
(
'Invalid reference name'
)
...
...
app/services/create_tag_service.rb
View file @
2ad00f52
...
...
@@ -26,7 +26,7 @@ class CreateTagService < BaseService
project
.
gitlab_ci_service
.
async_execute
(
push_data
)
end
Event
.
create_ref_event
(
project
,
current_user
,
new_tag
,
'add'
,
'refs/tags'
)
Event
CreateService
.
new
.
push_ref
(
project
,
current_user
,
new_tag
,
'add'
,
'refs/tags'
)
success
(
new_tag
)
else
error
(
'Invalid reference name'
)
...
...
app/services/delete_branch_service.rb
View file @
2ad00f52
...
...
@@ -25,7 +25,7 @@ class DeleteBranchService < BaseService
end
if
repository
.
rm_branch
(
branch_name
)
Event
.
create_ref_event
(
project
,
current_user
,
branch
,
'rm'
)
Event
CreateService
.
new
.
push_ref
(
project
,
current_user
,
branch
,
'rm'
)
success
(
'Branch was removed'
)
else
return
error
(
'Failed to remove branch'
)
...
...
app/services/event_create_service.rb
View file @
2ad00f52
...
...
@@ -7,58 +7,98 @@
#
class
EventCreateService
def
open_issue
(
issue
,
current_user
)
create_event
(
issue
,
current_user
,
Event
::
CREATED
)
create_
record_
event
(
issue
,
current_user
,
Event
::
CREATED
)
end
def
close_issue
(
issue
,
current_user
)
create_event
(
issue
,
current_user
,
Event
::
CLOSED
)
create_
record_
event
(
issue
,
current_user
,
Event
::
CLOSED
)
end
def
reopen_issue
(
issue
,
current_user
)
create_event
(
issue
,
current_user
,
Event
::
REOPENED
)
create_
record_
event
(
issue
,
current_user
,
Event
::
REOPENED
)
end
def
open_mr
(
merge_request
,
current_user
)
create_event
(
merge_request
,
current_user
,
Event
::
CREATED
)
create_
record_
event
(
merge_request
,
current_user
,
Event
::
CREATED
)
end
def
close_mr
(
merge_request
,
current_user
)
create_event
(
merge_request
,
current_user
,
Event
::
CLOSED
)
create_
record_
event
(
merge_request
,
current_user
,
Event
::
CLOSED
)
end
def
reopen_mr
(
merge_request
,
current_user
)
create_event
(
merge_request
,
current_user
,
Event
::
REOPENED
)
create_
record_
event
(
merge_request
,
current_user
,
Event
::
REOPENED
)
end
def
merge_mr
(
merge_request
,
current_user
)
create_event
(
merge_request
,
current_user
,
Event
::
MERGED
)
create_
record_
event
(
merge_request
,
current_user
,
Event
::
MERGED
)
end
def
open_milestone
(
milestone
,
current_user
)
create_event
(
milestone
,
current_user
,
Event
::
CREATED
)
create_
record_
event
(
milestone
,
current_user
,
Event
::
CREATED
)
end
def
close_milestone
(
milestone
,
current_user
)
create_event
(
milestone
,
current_user
,
Event
::
CLOSED
)
create_
record_
event
(
milestone
,
current_user
,
Event
::
CLOSED
)
end
def
reopen_milestone
(
milestone
,
current_user
)
create_event
(
milestone
,
current_user
,
Event
::
REOPENED
)
create_
record_
event
(
milestone
,
current_user
,
Event
::
REOPENED
)
end
def
leave_note
(
note
,
current_user
)
create_event
(
note
,
current_user
,
Event
::
COMMENTED
)
create_record_event
(
note
,
current_user
,
Event
::
COMMENTED
)
end
def
join_project
(
project
,
current_user
)
create_event
(
project
,
current_user
,
Event
::
JOINED
)
end
def
leave_project
(
project
,
current_user
)
create_event
(
project
,
current_user
,
Event
::
LEFT
)
end
def
create_project
(
project
,
current_user
)
create_event
(
project
,
current_user
,
Event
::
CREATED
)
end
def
push_ref
(
project
,
current_user
,
ref
,
action
=
'add'
,
prefix
=
'refs/heads'
)
commit
=
project
.
repository
.
commit
(
ref
.
target
)
if
action
.
to_s
==
'add'
before
=
'00000000'
after
=
commit
.
id
else
before
=
commit
.
id
after
=
'00000000'
end
data
=
{
ref:
"
#{
prefix
}
/
#{
ref
.
name
}
"
,
before:
before
,
after:
after
}
push
(
project
,
current_user
,
data
)
end
def
push
(
project
,
current_user
,
push_data
)
create_event
(
project
,
current_user
,
Event
::
PUSHED
,
data:
push_data
)
end
private
def
create_event
(
record
,
current_user
,
status
)
Event
.
create
(
project:
record
.
project
,
target_id:
record
.
id
,
target_type:
record
.
class
.
name
,
def
create_record_event
(
record
,
current_user
,
status
)
create_event
(
record
.
project
,
current_user
,
status
,
target_id:
record
.
id
,
target_type:
record
.
class
.
name
)
end
def
create_event
(
project
,
current_user
,
status
,
attributes
=
{})
attributes
.
reverse_merge!
(
project:
project
,
action:
status
,
author_id:
current_user
.
id
)
Event
.
create
(
attributes
)
end
end
app/services/git_push_service.rb
View file @
2ad00f52
...
...
@@ -52,7 +52,7 @@ class GitPushService
end
@push_data
=
post_receive_data
(
oldrev
,
newrev
,
ref
)
create_push_event
(
@push_data
)
EventCreateService
.
new
.
push
(
project
,
user
,
@push_data
)
project
.
execute_hooks
(
@push_data
.
dup
,
:push_hooks
)
project
.
execute_services
(
@push_data
.
dup
)
end
...
...
@@ -60,15 +60,6 @@ class GitPushService
protected
def
create_push_event
(
push_data
)
Event
.
create!
(
project:
project
,
action:
Event
::
PUSHED
,
data:
push_data
,
author_id:
push_data
[
:user_id
]
)
end
# Extract any GFM references from the pushed commit messages. If the configured issue-closing regex is matched,
# close the referenced Issue. Create cross-reference Notes corresponding to any other referenced Mentionables.
def
process_commit_messages
(
ref
)
...
...
app/services/git_tag_push_service.rb
View file @
2ad00f52
...
...
@@ -5,7 +5,7 @@ class GitTagPushService
@project
,
@user
=
project
,
user
@push_data
=
create_push_data
(
oldrev
,
newrev
,
ref
)
create_push_event
EventCreateService
.
new
.
push
(
project
,
user
,
@push_data
)
project
.
repository
.
expire_cache
project
.
execute_hooks
(
@push_data
.
dup
,
:tag_push_hooks
)
...
...
@@ -22,13 +22,4 @@ class GitTagPushService
Gitlab
::
PushDataBuilder
.
build
(
project
,
user
,
oldrev
,
newrev
,
ref
,
[])
end
def
create_push_event
Event
.
create!
(
project:
project
,
action:
Event
::
PUSHED
,
data:
push_data
,
author_id:
push_data
[
:user_id
]
)
end
end
app/services/projects/create_service.rb
View file @
2ad00f52
...
...
@@ -52,13 +52,7 @@ module Projects
end
end
if
@project
.
persisted?
if
@project
.
wiki_enabled?
@project
.
create_wiki
end
after_create_actions
end
after_create_actions
if
@project
.
persisted?
@project
rescue
=>
ex
...
...
@@ -79,6 +73,10 @@ module Projects
def
after_create_actions
log_info
(
"
#{
@project
.
owner
.
name
}
created a new project
\"
#{
@project
.
name_with_namespace
}
\"
"
)
@project
.
create_wiki
if
@project
.
wiki_enabled?
event_service
.
create_project
(
@project
,
current_user
)
system_hook_service
.
execute_hooks_for
(
@project
,
:create
)
unless
@project
.
group
...
...
app/views/admin/application_settings/_form.html.haml
View file @
2ad00f52
...
...
@@ -19,6 +19,11 @@
=
f
.
label
:gravatar_enabled
,
class:
'control-label'
.col-sm-10
=
f
.
check_box
:gravatar_enabled
,
class:
'checkbox'
.form-group
=
f
.
label
:twitter_sharing_enabled
,
"Twitter enabled"
,
class:
'control-label'
.col-sm-10
=
f
.
check_box
:twitter_sharing_enabled
,
class:
'checkbox'
%span
.help-block
Show users button to share their newly created public or internal projects on twitter
%fieldset
%legend
Misc
.form-group
...
...
app/views/events/_event.html.haml
View file @
2ad00f52
...
...
@@ -3,12 +3,14 @@
.event-item-timestamp
#{
time_ago_with_tooltip
(
event
.
created_at
)
}
=
cache
event
do
=
cache
[
event
,
current_user
]
do
=
image_tag
avatar_icon
(
event
.
author_email
,
24
),
class:
"avatar s24"
,
alt
:''
-
if
event
.
push?
=
render
"events/event/push"
,
event:
event
-
elsif
event
.
note
?
-
elsif
event
.
commented
?
=
render
"events/event/note"
,
event:
event
-
elsif
event
.
created_project?
=
render
"events/event/created_project"
,
event:
event
-
else
=
render
"events/event/common"
,
event:
event
\ No newline at end of file
app/views/events/event/_common.html.haml
View file @
2ad00f52
.event-title
%span
.author_name
=
link_to_author
event
%span
.event_label
{
class:
event
.
action_name
}=
event_action_name
(
event
)
%span
.event_label
{
class:
event
.
action_name
}
=
event_action_name
(
event
)
-
if
event
.
target
%strong
=
link_to
"#
#{
event
.
target_iid
}
"
,
[
event
.
project
,
event
.
target
]
-
else
%strong
=
gfm
event
.
target_title
at
-
if
event
.
project
=
link_to_project
event
.
project
-
else
=
event
.
project_name
-
if
event
.
target
.
respond_to?
(
:title
)
.event-body
.event-note
...
...
app/views/events/event/_created_project.html.haml
0 → 100644
View file @
2ad00f52
.event-title
%span
.author_name
=
link_to_author
event
%span
.event_label
{
class:
event
.
action_name
}
=
event_action_name
(
event
)
-
if
event
.
project
=
link_to_project
event
.
project
-
else
=
event
.
project_name
-
if
current_user
==
event
.
author
&&
!
event
.
project
.
private?
&&
twitter_sharing_enabled?
.event-body
.event-note
.md
%p
Congratulations! Why not share your accomplishment with the world?
%a
.twitter-share-button
{
|
href:
"https://twitter.com/share"
,
|
"data-url"
=>
event
.
project
.
web_url
,
|
"data-text"
=>
"I just created a new project in GitLab! GitLab is version control on your server."
,
|
"data-size"
=>
"medium"
,
|
"data-related"
=>
"gitlab"
,
|
"data-hashtags"
=>
"gitlab"
,
|
"data-count"
=>
"none"
}
Tweet
%script
{
src:
"//platform.twitter.com/widgets.js"
}
\ No newline at end of file
app/views/events/event/_note.html.haml
View file @
2ad00f52
.event-title
%span
.author_name
=
link_to_author
event
%span
.event_label
commented on
#{
event_note_title_html
(
event
)
}
at
%span
.event_label
=
event
.
action_name
=
event_note_title_html
(
event
)
at
-
if
event
.
project
=
link_to_project
event
.
project
-
else
...
...
app/views/events/event/_push.html.haml
View file @
2ad00f52
.event-title
%span
.author_name
=
link_to_author
event
%span
.event_label.pushed
#{
event
.
push_
action_name
}
#{
event
.
ref_type
}
%span
.event_label.pushed
#{
event
.
action_name
}
#{
event
.
ref_type
}
-
if
event
.
rm_ref?
%strong
=
event
.
ref_name
-
else
...
...
config/initializers/1_settings.rb
View file @
2ad00f52
...
...
@@ -112,6 +112,7 @@ end
Settings
.
gitlab
[
'time_zone'
]
||=
nil
Settings
.
gitlab
[
'signup_enabled'
]
||=
true
if
Settings
.
gitlab
[
'signup_enabled'
].
nil?
Settings
.
gitlab
[
'signin_enabled'
]
||=
true
if
Settings
.
gitlab
[
'signin_enabled'
].
nil?
Settings
.
gitlab
[
'twitter_sharing_enabled'
]
||=
true
if
Settings
.
gitlab
[
'twitter_sharing_enabled'
].
nil?
Settings
.
gitlab
[
'restricted_visibility_levels'
]
=
Settings
.
send
(
:verify_constant_array
,
Gitlab
::
VisibilityLevel
,
Settings
.
gitlab
[
'restricted_visibility_levels'
],
[])
Settings
.
gitlab
[
'username_changing_enabled'
]
=
true
if
Settings
.
gitlab
[
'username_changing_enabled'
].
nil?
Settings
.
gitlab
[
'issue_closing_pattern'
]
=
'((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e[sd]|ing)?|[Rr]esolv(?:e[sd]?|ing)) +(?:(?:issues? +)?#\d+(?:(?:, *| +and +)?))+)'
if
Settings
.
gitlab
[
'issue_closing_pattern'
].
nil?
...
...
db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb
0 → 100644
View file @
2ad00f52
class
AddTwitterSharingEnabledToApplicationSettings
<
ActiveRecord
::
Migration
def
change
add_column
:application_settings
,
:twitter_sharing_enabled
,
:boolean
,
default:
true
end
end
features/dashboard/dashboard.feature
View file @
2ad00f52
...
...
@@ -27,11 +27,11 @@ Feature: Dashboard
Scenario
:
I
should see User joined Project event
Given
user with name
"John Doe"
joined project
"Shop"
When
I visit dashboard page
Then
I should see
"John Doe joined project
at
Shop"
event
Then
I should see
"John Doe joined project Shop"
event
@javascript
Scenario
:
I
should see User left Project event
Given
user with name
"John Doe"
joined project
"Shop"
And
user with name
"John Doe"
left project
"Shop"
When
I visit dashboard page
Then
I should see
"John Doe left project
at
Shop"
event
Then
I should see
"John Doe left project Shop"
event
features/steps/dashboard/dashboard.rb
View file @
2ad00f52
...
...
@@ -37,8 +37,8 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
)
end
step
'I should see "John Doe joined project
at
Shop" event'
do
page
.
should
have_content
"John Doe joined project
at
#{
project
.
name_with_namespace
}
"
step
'I should see "John Doe joined project Shop" event'
do
page
.
should
have_content
"John Doe joined project
#{
project
.
name_with_namespace
}
"
end
step
'user with name "John Doe" left project "Shop"'
do
...
...
@@ -50,8 +50,8 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
)
end
step
'I should see "John Doe left project
at
Shop" event'
do
page
.
should
have_content
"John Doe left project
at
#{
project
.
name_with_namespace
}
"
step
'I should see "John Doe left project Shop" event'
do
page
.
should
have_content
"John Doe left project
#{
project
.
name_with_namespace
}
"
end
step
'I have group with projects'
do
...
...
spec/requests/api/projects_spec.rb
View file @
2ad00f52
...
...
@@ -347,7 +347,7 @@ describe API::API, api: true do
end
describe
'GET /projects/:id/events'
do
before
{
project_member
}
before
{
project_member
2
}
it
'should return a project events'
do
get
api
(
"/projects/
#{
project
.
id
}
/events"
,
user
)
...
...
@@ -356,7 +356,7 @@ describe API::API, api: true do
expect
(
json_event
[
'action_name'
]).
to
eq
(
'joined'
)
expect
(
json_event
[
'project_id'
].
to_i
).
to
eq
(
project
.
id
)
expect
(
json_event
[
'author_username'
]).
to
eq
(
user
.
username
)
expect
(
json_event
[
'author_username'
]).
to
eq
(
user
3
.
username
)
end
it
'should return a 404 error if not found'
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