Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge tag 'v5.0.14' into stable/5
  • Loading branch information
oliverguenther committed Feb 5, 2016
2 parents a0fad1b + 4c74cf7 commit a1a10a8
Show file tree
Hide file tree
Showing 77 changed files with 682 additions and 195 deletions.
42 changes: 21 additions & 21 deletions Gemfile.lock
Expand Up @@ -63,10 +63,10 @@ GIT

GIT
remote: https://github.com/opf/openproject-translations.git
revision: 46bfcac8b31a745586c35e3feca3dccec4838842
revision: 7d1810e56cbf8b9476e4fa018d7b94fc8dab6026
branch: stable/5
specs:
openproject-translations (5.0.13)
openproject-translations (5.0.14)
crowdin-api (~> 0.4.0)
mixlib-shellout (~> 2.1.0)
rails (~> 4.2.3)
Expand Down Expand Up @@ -98,78 +98,78 @@ GIT
PATH
remote: vendored-plugins/openproject-announcements
specs:
openproject-announcements (5.0.13)
openproject-announcements (5.0.14)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-auth_plugins
specs:
openproject-auth_plugins (5.0.13)
openproject-auth_plugins (5.0.14)
omniauth (~> 1.0)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-backlogs
specs:
openproject-backlogs (5.0.13)
openproject-backlogs (5.0.14)
acts_as_silent_list (~> 2.0.0)
openproject-pdf_export
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-costs
specs:
openproject-costs (5.0.13)
openproject-costs (5.0.14)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-documents
specs:
openproject-documents (5.0.13)
openproject-documents (5.0.14)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-github_integration
specs:
openproject-github_integration (5.0.13)
openproject-github_integration (5.0.14)
openproject-webhooks (~> 5.0.1)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-global_roles
specs:
openproject-global_roles (5.0.13)
openproject-global_roles (5.0.14)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-help_link
specs:
openproject-help_link (5.0.13)
openproject-help_link (5.0.14)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-local_avatars
specs:
openproject-local_avatars (5.0.13)
openproject-local_avatars (5.0.14)
rails (~> 4.2.4)
rmagick (~> 2.15.4)

PATH
remote: vendored-plugins/openproject-meeting
specs:
openproject-meeting (5.0.13)
openproject-meeting (5.0.14)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-my_project_page
specs:
openproject-my_project_page (5.0.13)
openproject-my_project_page (5.0.14)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-openid_connect
specs:
openproject-openid_connect (5.0.13)
openproject-openid_connect (5.0.14)
lobby_boy (~> 0.1)
omniauth-openid_connect-providers (~> 0.1)
openproject-auth_plugins (~> 5.0.1)
Expand All @@ -178,41 +178,41 @@ PATH
PATH
remote: vendored-plugins/openproject-pdf_export
specs:
openproject-pdf_export (5.0.13)
openproject-pdf_export (5.0.14)
prawn (~> 0.14.0)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-reporting
specs:
openproject-reporting (5.0.13)
openproject-reporting (5.0.14)
openproject-costs (>= 5.0.1)
rails (~> 4.2.4)
reporting_engine (>= 1.1.0)

PATH
remote: vendored-plugins/openproject-themes-dark
specs:
openproject-themes-dark (5.0.13)
openproject-themes-dark (5.0.14)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-webhooks
specs:
openproject-webhooks (5.0.13)
openproject-webhooks (5.0.14)
rails (~> 4.2.4)

PATH
remote: vendored-plugins/openproject-xls_export
specs:
openproject-xls_export (5.0.13)
openproject-xls_export (5.0.14)
rails (~> 4.2.4)
spreadsheet (~> 0.8.9)

PATH
remote: vendored-plugins/reporting_engine
specs:
reporting_engine (5.0.13)
reporting_engine (5.0.14)
json
rails (~> 4.2.4)

Expand Down Expand Up @@ -719,7 +719,7 @@ GEM
uber (0.0.13)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
unf_ext (0.0.7.2)
unicorn (4.9.0)
kgio (~> 2.6)
rack
Expand Down
10 changes: 5 additions & 5 deletions app/assets/stylesheets/content/_news.sass
Expand Up @@ -27,6 +27,8 @@
//++
.news
margin-bottom: 3rem

&.box > p
margin-top: -15px

Expand All @@ -37,14 +39,12 @@
.additional-information
font-size: 11px

h4.overview
margin-bottom: 0
border: 0
.news--comment
font-size: 11px

.summary
font-style: italic
font-size: 1rem

p.author
font-style: italic
/* to accomodate the .profile-wrap class
height: 42px
Expand Up @@ -114,7 +114,7 @@
a:hover
text-decoration: none
.action-icon
color: $main-menu-font-color
color: $content-icon-link-color
&::before
padding: 0 0 0 0.3em

Expand Down
31 changes: 29 additions & 2 deletions app/controllers/concerns/user_invitation.rb
Expand Up @@ -27,7 +27,17 @@
#++

module UserInvitation
EVENT_NAME = 'user_invited'
module Events
class << self
def user_invited
'user_invited'
end

def user_reinvited
'user_reinvited'
end
end
end

module_function

Expand Down Expand Up @@ -61,6 +71,23 @@ def invite_new_user(email:, login: nil, first_name: nil, last_name: nil)
invite_user! user
end

##
# Sends a new invitation to the user with a new token.
#
# @param user_id [Integer] ID of the user to be re-invited.
# @return [Token] The new token used for the invitation.
def reinvite_user(user_id)
clear_tokens user_id

Token.create(user_id: user_id, action: token_action).tap do |token|
OpenProject::Notifications.send Events.user_reinvited, token
end
end

def clear_tokens(user_id)
Token.where(user_id: user_id, action: token_action).destroy_all
end

##
# Creates a placeholder name for the user based on their email address.
# For the unlikely case that the local or domain part of the email address
Expand Down Expand Up @@ -91,7 +118,7 @@ def invite_user!(user)
user, token = user_invitation user

if token
OpenProject::Notifications.send(EVENT_NAME, token)
OpenProject::Notifications.send(Events.user_invited, token)

user
end
Expand Down
16 changes: 15 additions & 1 deletion app/controllers/users_controller.rb
Expand Up @@ -39,7 +39,8 @@ class UsersController < ApplicationController
:edit_membership,
:destroy_membership,
:destroy,
:deletion_info]
:deletion_info,
:resend_invitation]
before_filter :require_login, only: [:deletion_info] # should also contain destroy but post data can not be redirected
before_filter :authorize_for_user, only: [:destroy]
before_filter :check_if_deletion_allowed, only: [:deletion_info,
Expand Down Expand Up @@ -267,6 +268,19 @@ def edit_membership
end
end

def resend_invitation
token = UserInvitation.reinvite_user @user.id

if token.persisted?
flash[:notice] = I18n.t(:notice_user_invitation_resent, email: @user.mail)
else
logger.error "could not re-invite #{@user.mail}: #{token.errors.full_messages.join(' ')}"
flash[:error] = I18n.t(:notice_internal_server_error, app_title: Setting.app_title)
end

redirect_to edit_user_path(@user)
end

def destroy
# true if the user deletes him/herself
self_delete = (@user == User.current)
Expand Down
28 changes: 15 additions & 13 deletions app/helpers/application_helper.rb
Expand Up @@ -222,27 +222,29 @@ def render_tabs(tabs)
end
end

def project_tree_options_for_select(projects, options = {}, &_block)
Project.project_level_list(projects).map { |element|
def project_tree_options_for_select(projects, selected: nil, disabled: {}, &_block)
options = ''.html_safe
Project.project_level_list(projects).each do |element|
identifier = element[:project].id
tag_options = {
value: h(element[:project].id),
value: h(identifier),
title: h(element[:project].name),
}

if options[:selected] == element[:project] ||
(options[:selected].respond_to?(:include?) &&
options[:selected].include?(element[:project]))

tag_options[:selected] = 'selected'
if !selected.nil? && selected.id == identifier
tag_options[:selected] = true
end

level_prefix = ''
level_prefix = ('&nbsp;' * 3 * element[:level] + '&#187; ').html_safe if element[:level] > 0
tag_options[:disabled] = true if disabled.include? identifier

content = ''.html_safe
content << ('&nbsp;' * 3 * element[:level] + '&#187; ').html_safe if element[:level] > 0
content << element[:project].name

tag_options.merge!(yield(element[:project])) if block_given?
options << content_tag('option', content, tag_options)
end

content_tag('option', level_prefix + h(element[:project].name), tag_options)
}.join('').html_safe
options
end

# Yields the given block for each project with its level in the tree
Expand Down
9 changes: 4 additions & 5 deletions app/helpers/users_helper.rb
Expand Up @@ -126,12 +126,11 @@ def change_user_status_links(user)
end

# Options for the new membership projects combo-box
#
# Disables projects the user is already member in
def options_for_membership_project_select(user, projects)
options = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---")
options << project_tree_options_for_select(projects) { |p|
{ disabled: (user.projects.include?(p)) }
}
options
options = project_tree_options_for_select(projects, disabled: user.projects.ids.to_set)
content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---") + options
end

def user_mail_notification_options(user)
Expand Down

0 comments on commit a1a10a8

Please sign in to comment.