Skip to content

Commit

Permalink
Merge branch 'release/12.0' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ulferts committed Nov 11, 2021
2 parents 138bd91 + c04193e commit 1b038e1
Show file tree
Hide file tree
Showing 72 changed files with 647 additions and 179 deletions.
2 changes: 1 addition & 1 deletion app/models/exports/concerns/csv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def format_csv(record, attribute)
def csv_export_filename
sane_filename(
"#{Setting.app_title} #{title} \
#{format_time_as_date(Time.zone.now, '%Y-%m-%d')}.xls"
#{format_time_as_date(Time.zone.now, '%Y-%m-%d')}.csv"
)
end
end
Expand Down
14 changes: 13 additions & 1 deletion app/models/wiki.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def find_or_new_page(title)
def find_page(title, options = {})
title = start_page if title.blank?

page = pages.find_by(slug: WikiPage.slug(title))
page = find_matching_slug(title)

if !page && !(options[:with_redirect] == false)
# search for a redirect
redirect = matching_redirect(title)
Expand All @@ -76,6 +77,17 @@ def find_page(title, options = {})
page
end

##
# Find a page by its slug
# first trying the english slug, and then the slug for the default language
# as that was previous behavior (cf., Bug OP#38606)
def find_matching_slug(title)
pages
.where(slug: WikiPage.slug(title))
.or(pages.where(slug: title.to_localized_slug(locale: Setting.default_language)))
.first
end

# Finds a page by title
# The given string can be of one of the forms: "title" or "project:title"
# Examples:
Expand Down
1 change: 1 addition & 0 deletions app/models/wiki_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class WikiPage < ApplicationRecord
url_attribute: :slug,
scope: :wiki_id, # Unique slugs per WIKI
sync_url: true, # Keep slug updated on #rename
locale: :en,
adapter: OpenProject::ActsAsUrl::Adapter::OpActiveRecord # use a custom adapter able to handle edge cases

acts_as_watchable
Expand Down
23 changes: 18 additions & 5 deletions app/services/journals/create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,11 @@ def destroy_predecessor(journal)
predecessor = journal.previous

if aggregatable?(predecessor, journal)
notify_aggregation_destruction(predecessor, journal)

predecessor.destroy
if predecessor.notes.present?
journal.update_columns(notes: predecessor.notes, version: predecessor.version)
else
journal.update_columns(version: predecessor.version)
end

take_over_journal_details(predecessor, journal)
end
end

Expand Down Expand Up @@ -493,5 +492,19 @@ def aggregatable?(predecessor, journal)
predecessor.user_id == journal.user_id &&
(predecessor.notes.empty? || journal.notes.empty?)
end

def notify_aggregation_destruction(predecessor, journal)
OpenProject::Notifications.send(OpenProject::Events::JOURNAL_AGGREGATE_BEFORE_DESTROY,
journal: journal,
predecessor: predecessor)
end

def take_over_journal_details(predecessor, journal)
if predecessor.notes.present?
journal.update_columns(notes: predecessor.notes, version: predecessor.version)
else
journal.update_columns(version: predecessor.version)
end
end
end
end
41 changes: 41 additions & 0 deletions app/services/notifications/aggregated_journal_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#-- encoding: UTF-8

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++

class Notifications::AggregatedJournalService
##
# Move existing notifications for aggregated events over
# if they have an immediate response associated
def self.relocate_immediate(journal:, predecessor:)
Notification
.where(journal_id: predecessor.id)
.where(reason: :mentioned)
.update_all(journal_id: journal.id, read_ian: false)
end
end
10 changes: 10 additions & 0 deletions app/services/notifications/create_from_model_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def add_receivers_by_reason(receivers, reason)
end

def settings_of_mentioned
return NotificationSetting.none if has_aggregated_notification?(journal)

project_applicable_settings(mentioned_ids,
project,
NotificationSetting::MENTIONED)
Expand Down Expand Up @@ -259,6 +261,14 @@ def remove_self_recipient(receivers)
receivers.delete(user_with_fallback.id)
end

##
# If the journal has any mentioned notification
# then the mention was aggregated to a new journal
# by +Notifications::AggregatedJournalService+
def has_aggregated_notification?(journal)
Notification.exists?(journal_id: journal.id, reason: :mentioned)
end

def receivers_hash
Hash.new do |hash, user|
hash[user] = []
Expand Down
52 changes: 26 additions & 26 deletions app/views/projects/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,34 +64,34 @@ See COPYRIGHT and LICENSE files for more details.
<%= op_icon("button--icon icon-external-link") %>
<% end %>
</li>
<% if current_user.admin? %>
<li class="toolbar-item drop-down">
<a
href="#"
aria-haspopup="true"
title="<%= t(:label_more) %>"
class="button"
data-qa-selector="project-more-dropdown-menu"
>
<%= op_icon('button--icon icon-show-more') %>
</a>
<ul style="display:none;" class="menu-drop-down-container">
<li class="toolbar-item drop-down">
<a
href="#"
aria-haspopup="true"
title="<%= t(:label_more) %>"
class="button"
data-qa-selector="project-more-dropdown-menu"
>
<%= op_icon('button--icon icon-show-more') %>
</a>
<ul style="display:none;" class="menu-drop-down-container">
<% if current_user.admin? %>
<li>
<%= link_to t('button_configure'), admin_settings_projects_path, target: '_blank', class: 'icon-context icon-settings' %>
</li>
<% end %>
<section data-augmented-model-wrapper
data-modal-class-name="project-export---modal">
<li>
<%= link_to t('button_configure'), admin_settings_projects_path, target: '_blank', class: 'icon-context icon-settings' %>
<%= link_to I18n.t('js.label_export'),
'',
title: I18n.t('js.label_export'),
class: 'modal-delivery-element--activation-link icon-context icon-export' %>
</li>
<section data-augmented-model-wrapper
data-modal-class-name="project-export---modal">
<li>
<%= link_to I18n.t('js.label_export'),
'',
title: I18n.t('js.label_export'),
class: 'modal-delivery-element--activation-link icon-context icon-export' %>
</li>
<%= render partial: 'project_export_modal' %>
</section>
</ul>
</li>
<% end %>
<%= render partial: 'project_export_modal' %>
</section>
</ul>
</li>
<% end %>
<%= render partial: 'projects/filters/form', locals: { query: @query } %>
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/subscribe_listeners.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
Journals::CompletedJob.schedule(payload[:journal], payload[:send_notification])
end

OpenProject::Notifications.subscribe(OpenProject::Events::JOURNAL_AGGREGATE_BEFORE_DESTROY) do |payload|
Notifications::AggregatedJournalService.relocate_immediate(**payload.slice(:journal, :predecessor))
end

OpenProject::Notifications.subscribe(OpenProject::Events::WATCHER_ADDED) do |payload|
next unless payload[:send_notifications]

Expand Down
2 changes: 1 addition & 1 deletion config/locales/crowdin/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ ar:
This also means that we will no longer be using emails for notifications. We think Notification Center is a better place to view and act upon these updates. Nevertheless, if you would like continue receiving updates via email, you can choose to receive daily email reminders at particular times of your choosing.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button bellow.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button below.
We hope you find Notification Center useful and that it makes you even more productive.
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crowdin/bg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ bg:
This also means that we will no longer be using emails for notifications. We think Notification Center is a better place to view and act upon these updates. Nevertheless, if you would like continue receiving updates via email, you can choose to receive daily email reminders at particular times of your choosing.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button bellow.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button below.
We hope you find Notification Center useful and that it makes you even more productive.
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crowdin/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ ca:
This also means that we will no longer be using emails for notifications. We think Notification Center is a better place to view and act upon these updates. Nevertheless, if you would like continue receiving updates via email, you can choose to receive daily email reminders at particular times of your choosing.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button bellow.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button below.
We hope you find Notification Center useful and that it makes you even more productive.
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crowdin/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ cs:
This also means that we will no longer be using emails for notifications. We think Notification Center is a better place to view and act upon these updates. Nevertheless, if you would like continue receiving updates via email, you can choose to receive daily email reminders at particular times of your choosing.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button bellow.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button below.
We hope you find Notification Center useful and that it makes you even more productive.
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crowdin/da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ da:
This also means that we will no longer be using emails for notifications. We think Notification Center is a better place to view and act upon these updates. Nevertheless, if you would like continue receiving updates via email, you can choose to receive daily email reminders at particular times of your choosing.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button bellow.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button below.
We hope you find Notification Center useful and that it makes you even more productive.
Expand Down
14 changes: 7 additions & 7 deletions config/locales/crowdin/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1343,18 +1343,18 @@ de:
watched: "Du beobachtest %{work_package}"
update_info_mail:
body: >
Mit Spannung kündigen wir die Veröffentlichung von OpenProject 12.0. Es ist eine wichtige Aktualisierung, die Ihre Arbeit mit OpenProject erheblich verbessern wird.
We are excited to announce the release of OpenProject 12.0. It's a major release that will hopefully significantly improve the way you use OpenProject.
Beginnend mit dieser Version führen wir eine Benachrichtigungszentrale ein. Von nun an erhalten Sie Benachrichtigungen für Aktualisierungen zu Arbeitspaketen direkt in OpenProject. Sie können diese Benachrichtigungen als gelesen markieren, auf einen Kommentar antworten oder sogar direkt die Attribute des Arbeitspakets ändern, ohne das Benachrichtigungszentrum zu verlassen.
Starting with this release, we are introducing Notification Center. From now on, you will receive notifications for updates to work packages directly in OpenProject. You can mark these notifications as read, reply to a comment or even directly modify work package attributes without leaving Notification Center.
Dies bedeutet auch, dass wir weniger E-Mails für Benachrichtigungen verwenden. Das Benachrichtigungszentrum wird ein besserer Ort werden, um diese Updates anzusehen und zu bearbeiten. Wenn Sie dennoch weiterhin Updates per E-Mail erhalten möchten, können Sie zu wählbaren Zeiten tägliche E-Mail-Erinnerungen erhalten.
This also means that we will no longer be using emails for notifications. We think Notification Center is a better place to view and act upon these updates. Nevertheless, if you would like continue receiving updates via email, you can choose to receive daily email reminders at particular times of your choosing.
Sie können Ihre Einstellungen für Benachrichtigungen und E-Mail-Erinnerungen über Ihre Kontoeinstellungen festlegen oder diese unverändert lassen, um die Standardeinstellungen beizubehalten. Sie können dies über die Schaltfläche „E-Mail-Einstellungen ändern“ unten tun.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button below.
Wir hoffen, dass Sie das Benachrichtigungszentrum nützlich finden und dass es Sie noch produktiver macht.
We hope you find Notification Center useful and that it makes you even more productive.
Mit freundlichen Grüßen
Das OpenProject Team
Sincerely,
The OpenProject team
body_header: 'Version 12.0 mit Benachrichtigungszentrum'
body_subheader: 'Nachrichten'
subject: 'Wichtige Änderungen an Benachrichtigungen mit der Veröffentlichung von 12.0'
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crowdin/el.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ el:
This also means that we will no longer be using emails for notifications. We think Notification Center is a better place to view and act upon these updates. Nevertheless, if you would like continue receiving updates via email, you can choose to receive daily email reminders at particular times of your choosing.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button bellow.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button below.
We hope you find Notification Center useful and that it makes you even more productive.
Expand Down
16 changes: 8 additions & 8 deletions config/locales/crowdin/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ es:
error_can_not_delete_custom_field: "Imposible eliminar el campo seleccionado"
error_can_not_delete_type:
explanation: 'Este tipo contiene paquetes de trabajo y no se puede eliminar. Puede ver todos los paquetes de trabajo afectados en <a target="_blank" href="%{url}">esta vista</a>.'
archived_projects: 'Hay paquetes de trabajo en los proyectos archivados. Para poder cambiar el tipo de los paquetes de trabajo correspondientes, antes necesita reactivar los proyectos siguientes: %{archived_projects}'
archived_projects: 'Hay paquetes de trabajo en los proyectos archivados. Necesita reactivar los proyectos siguientes para cambiar el tipo de los paquetes de trabajo correspondientes: %{archived_projects}'
error_can_not_delete_standard_type: "Tipos estándar no se pueden borrar."
error_can_not_invite_user: "Error al enviar la invitación al usuario."
error_can_not_remove_role: "Este rol esta en uso y no puede ser eliminado"
Expand Down Expand Up @@ -1345,18 +1345,18 @@ es:
watched: "Estás viendo a %{work_package}"
update_info_mail:
body: >
Nos complace anunciar la publicación de OpenProject 12.0. Es una versión principal que esperamos que mejore en gran medida la forma en que usa OpenProject.
We are excited to announce the release of OpenProject 12.0. It's a major release that will hopefully significantly improve the way you use OpenProject.
En esta versión, introducimos el Centro de notificaciones. A partir de ahora, recibirá notificaciones de actualizaciones sobre paquetes de trabajo directamente en OpenProject. Puede marcar estas notificaciones como leídas, responder a un comentario o incluso modificar directamente los atributos de un paquete de trabajo sin salir del Centro de notificaciones.
Starting with this release, we are introducing Notification Center. From now on, you will receive notifications for updates to work packages directly in OpenProject. You can mark these notifications as read, reply to a comment or even directly modify work package attributes without leaving Notification Center.
Esto también quiere decir que ya no usaremos correos electrónicos para las notificaciones. Creemos que el Centro de notificaciones es el lugar más adecuado para ver y actuar en estas actualizaciones. Sin embargo, si prefiere seguir recibiendo actualizaciones por correo electrónico, puede elegir recibir recordatorios por correo electrónico diarios en las horas que prefiera.
This also means that we will no longer be using emails for notifications. We think Notification Center is a better place to view and act upon these updates. Nevertheless, if you would like continue receiving updates via email, you can choose to receive daily email reminders at particular times of your choosing.
Puede establecer preferencias para notificaciones y recordatorios por correo electrónico en la configuración de la cuenta, o bien puede mantener las opciones predeterminadas. Puede hacerlo mediante el botón «Cambiar configuración de correo electrónico» siguiente.
You can set your preferences for notifications and email reminders via your account settings, or leave them unchanged to keep the default ones. You can do this through the “Change email settings” button below.
Esperamos que el Centro de notificaciones le parezca útil y que le permita ser incluso más productivo.
We hope you find Notification Center useful and that it makes you even more productive.
Atentamente,
El equipo de OpenProject
Sincerely,
The OpenProject team
body_header: 'Versión 12.0 con el Centro de notificaciones'
body_subheader: 'Noticias'
subject: 'Cambios importantes en las notificaciones con la publicación de la versión 12.0'
Expand Down
Loading

0 comments on commit 1b038e1

Please sign in to comment.