Commit 2ad00f52 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'tweet-new-project'

Conflicts:
	db/schema.rb
parents 26d594f2 67afb5b1
...@@ -53,6 +53,7 @@ v 7.8.0 (unreleased) ...@@ -53,6 +53,7 @@ v 7.8.0 (unreleased)
- Show assignees in merge request index page (Kelvin Mutuma) - Show assignees in merge request index page (Kelvin Mutuma)
- Link head panel titles to relevant root page. - 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). - 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 v 7.7.2
- Update GitLab Shell to version 2.4.2 that fixes a bug when developers can push to protected branch - Update GitLab Shell to version 2.4.2 that fixes a bug when developers can push to protected branch
......
...@@ -64,6 +64,10 @@ ...@@ -64,6 +64,10 @@
.md { .md {
font-size: 13px; font-size: 13px;
iframe.twitter-share-button {
vertical-align: bottom;
}
} }
pre { pre {
......
...@@ -26,6 +26,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -26,6 +26,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:signup_enabled, :signup_enabled,
:signin_enabled, :signin_enabled,
:gravatar_enabled, :gravatar_enabled,
:twitter_sharing_enabled,
:sign_in_text, :sign_in_text,
:home_page_url :home_page_url
) )
......
...@@ -27,7 +27,7 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -27,7 +27,7 @@ class Projects::TagsController < Projects::ApplicationController
tag = @repository.find_tag(params[:id]) tag = @repository.find_tag(params[:id])
if tag && @repository.rm_tag(tag.name) 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 end
respond_to do |format| respond_to do |format|
......
...@@ -3,6 +3,10 @@ module ApplicationSettingsHelper ...@@ -3,6 +3,10 @@ module ApplicationSettingsHelper
current_application_settings.gravatar_enabled? current_application_settings.gravatar_enabled?
end end
def twitter_sharing_enabled?
current_application_settings.twitter_sharing_enabled?
end
def signup_enabled? def signup_enabled?
current_application_settings.signup_enabled? current_application_settings.signup_enabled?
end end
......
...@@ -10,11 +10,15 @@ module EventsHelper ...@@ -10,11 +10,15 @@ module EventsHelper
end end
def event_action_name(event) def event_action_name(event)
target = if event.target_type target = if event.target_type
event.target_type.titleize.downcase if event.note?
else event.note_target_type
'project' else
end event.target_type.titleize.downcase
end
else
'project'
end
[event.action_name, target].join(" ") [event.action_name, target].join(" ")
end end
...@@ -42,21 +46,30 @@ module EventsHelper ...@@ -42,21 +46,30 @@ module EventsHelper
end end
def event_feed_title(event) def event_feed_title(event)
if event.issue? words = []
"#{event.author_name} #{event.action_name} issue ##{event.target_iid}: #{event.issue_title} at #{event.project_name}" words << event.author_name
elsif event.merge_request? words << event_action_name(event)
"#{event.author_name} #{event.action_name} MR ##{event.target_iid}: #{event.merge_request_title} at #{event.project_name}"
elsif event.push? if event.push?
"#{event.author_name} #{event.push_action_name} #{event.ref_type} #{event.ref_name} at #{event.project_name}" words << event.ref_type
elsif event.membership_changed? words << event.ref_name
"#{event.author_name} #{event.action_name} #{event.project_name}" words << "at"
elsif event.note? && event.note_commit? elsif event.commented?
"#{event.author_name} commented on #{event.note_target_type} #{event.note_short_commit_id} at #{event.project_name}" if event.note_commit?
elsif event.note? words << event.note_short_commit_id
"#{event.author_name} commented on #{event.note_target_type} ##{truncate event.note_target_iid} at #{event.project_name}" else
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 end
words << event.project_name
words.join(" ")
end end
def event_feed_url(event) def event_feed_url(event)
...@@ -96,8 +109,6 @@ module EventsHelper ...@@ -96,8 +109,6 @@ module EventsHelper
render "events/event_push", event: event render "events/event_push", event: event
elsif event.merge_request? elsif event.merge_request?
render "events/event_merge_request", merge_request: 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? elsif event.note?
render "events/event_note", note: event.note render "events/event_note", note: event.note
end end
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
# signup_enabled :boolean # signup_enabled :boolean
# signin_enabled :boolean # signin_enabled :boolean
# gravatar_enabled :boolean # gravatar_enabled :boolean
# twitter_sharing_enabled :boolean
# sign_in_text :text # sign_in_text :text
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
...@@ -30,6 +31,7 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -30,6 +31,7 @@ class ApplicationSetting < ActiveRecord::Base
default_branch_protection: Settings.gitlab['default_branch_protection'], default_branch_protection: Settings.gitlab['default_branch_protection'],
signup_enabled: Settings.gitlab['signup_enabled'], signup_enabled: Settings.gitlab['signup_enabled'],
signin_enabled: Settings.gitlab['signin_enabled'], signin_enabled: Settings.gitlab['signin_enabled'],
twitter_sharing_enabled: Settings.gitlab['twitter_sharing_enabled'],
gravatar_enabled: Settings.gravatar['enabled'], gravatar_enabled: Settings.gravatar['enabled'],
sign_in_text: Settings.extra['sign_in_text'], sign_in_text: Settings.extra['sign_in_text'],
) )
......
...@@ -49,29 +49,6 @@ class Event < ActiveRecord::Base ...@@ -49,29 +49,6 @@ class Event < ActiveRecord::Base
scope :in_projects, ->(project_ids) { where(project_id: project_ids).recent } scope :in_projects, ->(project_ids) { where(project_id: project_ids).recent }
class << self 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) def reset_event_cache_for(target)
Event.where(target_id: target.id, target_type: target.class.to_s). Event.where(target_id: target.id, target_type: target.class.to_s).
order('id DESC').limit(100). order('id DESC').limit(100).
...@@ -84,6 +61,8 @@ class Event < ActiveRecord::Base ...@@ -84,6 +61,8 @@ class Event < ActiveRecord::Base
true true
elsif membership_changed? elsif membership_changed?
true true
elsif created_project?
true
else else
(issue? || merge_request? || note? || milestone?) && target (issue? || merge_request? || note? || milestone?) && target
end end
...@@ -98,25 +77,51 @@ class Event < ActiveRecord::Base ...@@ -98,25 +77,51 @@ class Event < ActiveRecord::Base
end end
def target_title def target_title
if target && target.respond_to?(:title) target.title if target && target.respond_to?(:title)
target.title end
end
def created?
action == CREATED
end end
def push? def push?
action == self.class::PUSHED && valid_push? action == PUSHED && valid_push?
end end
def merged? def merged?
action == self.class::MERGED action == MERGED
end end
def closed? def closed?
action == self.class::CLOSED action == CLOSED
end end
def reopened? 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 end
def milestone? def milestone?
...@@ -135,32 +140,32 @@ class Event < ActiveRecord::Base ...@@ -135,32 +140,32 @@ class Event < ActiveRecord::Base
target_type == "MergeRequest" target_type == "MergeRequest"
end end
def joined? def milestone
action == JOINED target if milestone?
end
def left?
action == LEFT
end
def membership_changed?
joined? || left?
end end
def issue def issue
target if target_type == "Issue" target if issue?
end end
def merge_request def merge_request
target if target_type == "MergeRequest" target if merge_request?
end end
def note def note
target if target_type == "Note" target if note?
end end
def action_name def action_name
if closed? if push?
if new_ref?
"pushed new"
elsif rm_ref?
"deleted"
else
"pushed to"
end
elsif closed?
"closed" "closed"
elsif merged? elsif merged?
"accepted" "accepted"
...@@ -168,6 +173,10 @@ class Event < ActiveRecord::Base ...@@ -168,6 +173,10 @@ class Event < ActiveRecord::Base
'joined' 'joined'
elsif left? elsif left?
'left' 'left'
elsif commented?
"commented on"
elsif created_project?
"created"
else else
"opened" "opened"
end end
...@@ -236,16 +245,6 @@ class Event < ActiveRecord::Base ...@@ -236,16 +245,6 @@ class Event < ActiveRecord::Base
tag? ? "tag" : "branch" tag? ? "tag" : "branch"
end end
def push_action_name
if new_ref?
"pushed new"
elsif rm_ref?
"deleted"
else
"pushed to"
end
end
def push_with_commits? def push_with_commits?
md_ref? && commits.any? && commit_from && commit_to md_ref? && commits.any? && commit_from && commit_to
end end
......
...@@ -114,13 +114,11 @@ class ProjectMember < Member ...@@ -114,13 +114,11 @@ class ProjectMember < Member
end end
def post_create_hook def post_create_hook
Event.create( unless owner?
project_id: self.project.id, event_service.join_project(self.project, self.user)
action: Event::JOINED, notification_service.new_team_member(self)
author_id: self.user.id end
)
notification_service.new_team_member(self) unless owner?
system_hook_service.execute_hooks_for(self, :create) system_hook_service.execute_hooks_for(self, :create)
end end
...@@ -129,15 +127,14 @@ class ProjectMember < Member ...@@ -129,15 +127,14 @@ class ProjectMember < Member
end end
def post_destroy_hook def post_destroy_hook
Event.create( event_service.leave_project(self.project, self.user)
project_id: self.project.id,
action: Event::LEFT,
author_id: self.user.id
)
system_hook_service.execute_hooks_for(self, :destroy) system_hook_service.execute_hooks_for(self, :destroy)
end end
def event_service
EventCreateService.new
end
def notification_service def notification_service
NotificationService.new NotificationService.new
end end
......
...@@ -17,7 +17,7 @@ class CreateBranchService < BaseService ...@@ -17,7 +17,7 @@ class CreateBranchService < BaseService
new_branch = repository.find_branch(branch_name) new_branch = repository.find_branch(branch_name)
if new_branch 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) return success(new_branch)
else else
return error('Invalid reference name') return error('Invalid reference name')
......
...@@ -26,7 +26,7 @@ class CreateTagService < BaseService ...@@ -26,7 +26,7 @@ class CreateTagService < BaseService
project.gitlab_ci_service.async_execute(push_data) project.gitlab_ci_service.async_execute(push_data)
end 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) success(new_tag)
else else
error('Invalid reference name') error('Invalid reference name')
......
...@@ -25,7 +25,7 @@ class DeleteBranchService < BaseService ...@@ -25,7 +25,7 @@ class DeleteBranchService < BaseService
end end
if repository.rm_branch(branch_name) 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') success('Branch was removed')
else else
return error('Failed to remove branch') return error('Failed to remove branch')
......
...@@ -7,58 +7,98 @@ ...@@ -7,58 +7,98 @@
# #
class EventCreateService class EventCreateService
def open_issue(issue, current_user) def open_issue(issue, current_user)
create_event(issue, current_user, Event::CREATED) create_record_event(issue, current_user, Event::CREATED)
end end
def close_issue(issue, current_user) def close_issue(issue, current_user)
create_event(issue, current_user, Event::CLOSED) create_record_event(issue, current_user, Event::CLOSED)
end end
def reopen_issue(issue, current_user) def reopen_issue(issue, current_user)
create_event(issue, current_user, Event::REOPENED) create_record_event(issue, current_user, Event::REOPENED)
end end
def open_mr(merge_request, current_user) 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 end
def close_mr(merge_request, current_user) 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 end
def reopen_mr(merge_request, current_user) 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 end
def merge_mr(merge_request, current_user) 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 end
def open_milestone(milestone, current_user) def open_milestone(milestone, current_user)
create_event(milestone, current_user, Event::CREATED) create_record_event(milestone, current_user, Event::CREATED)
end end
def close_milestone(milestone, current_user) def close_milestone(milestone, current_user)
create_event(milestone, current_user, Event::CLOSED) create_record_event(milestone, current_user, Event::CLOSED)
end end
def reopen_milestone(milestone, current_user) def reopen_milestone(milestone, current_user)
create_event(milestone, current_user, Event::REOPENED) create_record_event(milestone, current_user, Event::REOPENED)
end end
def leave_note(note, current_user) 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 end
private private
def create_event(record, current_user, status) def create_record_event(record, current_user, status)
Event.create( create_event(record.project, current_user, status, target_id: record.id, target_type: record.class.name)
project: record.project, end
target_id: record.id,
target_type: record.class.name, def create_event(project, current_user, status, attributes = {})
attributes.reverse_merge!(
project: project,
action: status, action: status,
author_id: current_user.id author_id: current_user.id
) )
Event.create(attributes)
end end
end end
...@@ -52,7 +52,7 @@ class GitPushService ...@@ -52,7 +52,7 @@ class GitPushService
end end
@push_data = post_receive_data(oldrev, newrev, ref) @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_hooks(@push_data.dup, :push_hooks)
project.execute_services(@push_data.dup) project.execute_services(@push_data.dup)
end end
...@@ -60,15 +60,6 @@ class GitPushService ...@@ -60,15 +60,6 @@ class GitPushService
protected 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, # 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. # close the referenced Issue. Create cross-reference Notes corresponding to any other referenced Mentionables.
def process_commit_messages(ref) def process_commit_messages(ref)
......
...@@ -5,7 +5,7 @@ class GitTagPushService ...@@ -5,7 +5,7 @@ class GitTagPushService
@project, @user = project, user @project, @user = project, user
@push_data = create_push_data(oldrev, newrev, ref) @push_data = create_push_data(oldrev, newrev, ref)
create_push_event EventCreateService.new.push(project, user, @push_data)
project.repository.expire_cache project.repository.expire_cache
project.execute_hooks(@push_data.dup, :tag_push_hooks) project.execute_hooks(@push_data.dup, :tag_push_hooks)
...@@ -22,13 +22,4 @@ class GitTagPushService ...@@ -22,13 +22,4 @@ class GitTagPushService
Gitlab::PushDataBuilder. Gitlab::PushDataBuilder.
build(project, user, oldrev, newrev, ref, []) build(project, user, oldrev, newrev, ref, [])
end end
def create_push_event
Event.create!(
project: project,
action: Event::PUSHED,
data: push_data,
author_id: push_data[:user_id]
)
end
end end
...@@ -52,13 +52,7 @@ module Projects ...@@ -52,13 +52,7 @@ module Projects
end end
end end
if @project.persisted? after_create_actions if @project.persisted?
if @project.wiki_enabled?
@project.create_wiki
end
after_create_actions
end
@project @project
rescue => ex rescue => ex
...@@ -79,6 +73,10 @@ module Projects ...@@ -79,6 +73,10 @@ module Projects
def after_create_actions def after_create_actions
log_info("#{@project.owner.name} created a new project \"#{@project.name_with_namespace}\"") 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) system_hook_service.execute_hooks_for(@project, :create)
unless @project.group unless @project.group
......
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
= f.label :gravatar_enabled, class: 'control-label' = f.label :gravatar_enabled, class: 'control-label'
.col-sm-10 .col-sm-10
= f.check_box :gravatar_enabled, class: 'checkbox' = 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 %fieldset
%legend Misc %legend Misc
.form-group .form-group
......
...@@ -3,12 +3,14 @@ ...@@ -3,12 +3,14 @@
.event-item-timestamp .event-item-timestamp
#{time_ago_with_tooltip(event.created_at)} #{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:'' = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:''
- if event.push? - if event.push?
= render "events/event/push", event: event = render "events/event/push", event: event
- elsif event.note? - elsif event.commented?
= render "events/event/note", event: event = render "events/event/note", event: event
- elsif event.created_project?
= render "events/event/created_project", event: event
- else - else
= render "events/event/common", event: event = render "events/event/common", event: event
\ No newline at end of file
.event-title .event-title
%span.author_name= link_to_author event %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 - if event.target
%strong= link_to "##{event.target_iid}", [event.project, event.target] %strong= link_to "##{event.target_iid}", [event.project, event.target]
- else at
%strong= gfm event.target_title
at
- if event.project - if event.project
= link_to_project event.project = link_to_project event.project
- else - else
= event.project_name = event.project_name
- if event.target.respond_to?(:title) - if event.target.respond_to?(:title)
.event-body .event-body
.event-note .event-note
......
.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
.event-title .event-title
%span.author_name= link_to_author event %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 - if event.project
= link_to_project event.project = link_to_project event.project
- else - else
......
.event-title .event-title
%span.author_name= link_to_author event %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? - if event.rm_ref?
%strong= event.ref_name %strong= event.ref_name
- else - else
......
...@@ -112,6 +112,7 @@ end ...@@ -112,6 +112,7 @@ end
Settings.gitlab['time_zone'] ||= nil Settings.gitlab['time_zone'] ||= nil
Settings.gitlab['signup_enabled'] ||= true if Settings.gitlab['signup_enabled'].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['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['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['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? 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?
......
class AddTwitterSharingEnabledToApplicationSettings < ActiveRecord::Migration
def change
add_column :application_settings, :twitter_sharing_enabled, :boolean, default: true
end
end
...@@ -27,11 +27,11 @@ Feature: Dashboard ...@@ -27,11 +27,11 @@ Feature: Dashboard
Scenario: I should see User joined Project event Scenario: I should see User joined Project event
Given user with name "John Doe" joined project "Shop" Given user with name "John Doe" joined project "Shop"
When I visit dashboard page 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 @javascript
Scenario: I should see User left Project event Scenario: I should see User left Project event
Given user with name "John Doe" joined project "Shop" Given user with name "John Doe" joined project "Shop"
And user with name "John Doe" left project "Shop" And user with name "John Doe" left project "Shop"
When I visit dashboard page 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 ...@@ -37,8 +37,8 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
) )
end end
step 'I should see "John Doe joined project at Shop" event' do step 'I should see "John Doe joined project Shop" event' do
page.should have_content "John Doe joined project at #{project.name_with_namespace}" page.should have_content "John Doe joined project #{project.name_with_namespace}"
end end
step 'user with name "John Doe" left project "Shop"' do step 'user with name "John Doe" left project "Shop"' do
...@@ -50,8 +50,8 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps ...@@ -50,8 +50,8 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
) )
end end
step 'I should see "John Doe left project at Shop" event' do step 'I should see "John Doe left project Shop" event' do
page.should have_content "John Doe left project at #{project.name_with_namespace}" page.should have_content "John Doe left project #{project.name_with_namespace}"
end end
step 'I have group with projects' do step 'I have group with projects' do
......
...@@ -347,7 +347,7 @@ describe API::API, api: true do ...@@ -347,7 +347,7 @@ describe API::API, api: true do
end end
describe 'GET /projects/:id/events' do describe 'GET /projects/:id/events' do
before { project_member } before { project_member2 }
it 'should return a project events' do it 'should return a project events' do
get api("/projects/#{project.id}/events", user) get api("/projects/#{project.id}/events", user)
...@@ -356,7 +356,7 @@ describe API::API, api: true do ...@@ -356,7 +356,7 @@ describe API::API, api: true do
expect(json_event['action_name']).to eq('joined') expect(json_event['action_name']).to eq('joined')
expect(json_event['project_id'].to_i).to eq(project.id) 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 end
it 'should return a 404 error if not found' do it 'should return a 404 error if not found' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment