Merge branch 'tweet-new-project'
Conflicts: db/schema.rb
This commit is contained in:
commit
2ad00f5294
27 changed files with 236 additions and 151 deletions
|
@ -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
|
||||
|
|
|
@ -64,6 +64,10 @@
|
|||
|
||||
.md {
|
||||
font-size: 13px;
|
||||
|
||||
iframe.twitter-share-button {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
|
||||
pre {
|
||||
|
|
|
@ -26,6 +26,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
|
|||
:signup_enabled,
|
||||
:signin_enabled,
|
||||
:gravatar_enabled,
|
||||
:twitter_sharing_enabled,
|
||||
:sign_in_text,
|
||||
:home_page_url
|
||||
)
|
||||
|
|
|
@ -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')
|
||||
EventCreateService.new.push_ref(@project, current_user, tag, 'rm', 'refs/tags')
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -10,11 +10,15 @@ module EventsHelper
|
|||
end
|
||||
|
||||
def event_action_name(event)
|
||||
target = if event.target_type
|
||||
event.target_type.titleize.downcase
|
||||
else
|
||||
'project'
|
||||
end
|
||||
target = if event.target_type
|
||||
if event.note?
|
||||
event.note_target_type
|
||||
else
|
||||
event.target_type.titleize.downcase
|
||||
end
|
||||
else
|
||||
'project'
|
||||
end
|
||||
|
||||
[event.action_name, target].join(" ")
|
||||
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}"
|
||||
else
|
||||
""
|
||||
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
|
||||
|
|
|
@ -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'],
|
||||
)
|
||||
|
|
|
@ -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
|
||||
end
|
||||
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
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
||||
notification_service.new_team_member(self) unless owner?
|
||||
unless owner?
|
||||
event_service.join_project(self.project, self.user)
|
||||
notification_service.new_team_member(self)
|
||||
end
|
||||
|
||||
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
|
||||
|
|
|
@ -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')
|
||||
EventCreateService.new.push_ref(project, current_user, new_branch, 'add')
|
||||
return success(new_branch)
|
||||
else
|
||||
return error('Invalid reference name')
|
||||
|
|
|
@ -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')
|
||||
EventCreateService.new.push_ref(project, current_user, new_tag, 'add', 'refs/tags')
|
||||
success(new_tag)
|
||||
else
|
||||
error('Invalid reference name')
|
||||
|
|
|
@ -25,7 +25,7 @@ class DeleteBranchService < BaseService
|
|||
end
|
||||
|
||||
if repository.rm_branch(branch_name)
|
||||
Event.create_ref_event(project, current_user, branch, 'rm')
|
||||
EventCreateService.new.push_ref(project, current_user, branch, 'rm')
|
||||
success('Branch was removed')
|
||||
else
|
||||
return error('Failed to remove branch')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -1,15 +1,17 @@
|
|||
.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
|
||||
at
|
||||
|
||||
- if event.project
|
||||
= link_to_project event.project
|
||||
- else
|
||||
= event.project_name
|
||||
|
||||
- if event.target.respond_to?(:title)
|
||||
.event-body
|
||||
.event-note
|
||||
|
|
27
app/views/events/event/_created_project.html.haml
Normal file
27
app/views/events/event/_created_project.html.haml
Normal file
|
@ -0,0 +1,27 @@
|
|||
.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"}
|
|
@ -1,6 +1,10 @@
|
|||
.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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.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
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddTwitterSharingEnabledToApplicationSettings < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :application_settings, :twitter_sharing_enabled, :boolean, default: true
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -347,7 +347,7 @@ describe API::API, api: true do
|
|||
end
|
||||
|
||||
describe 'GET /projects/:id/events' do
|
||||
before { project_member }
|
||||
before { project_member2 }
|
||||
|
||||
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(user3.username)
|
||||
end
|
||||
|
||||
it 'should return a 404 error if not found' do
|
||||
|
|
Loading…
Reference in a new issue