Skip to content

Commit

Permalink
Merge branch 'release/15.0' into documentation/saml
Browse files Browse the repository at this point in the history
  • Loading branch information
MayaBerd authored Nov 8, 2024
2 parents c460fdb + 2a2b0a2 commit 7f3e779
Show file tree
Hide file tree
Showing 118 changed files with 1,168 additions and 761 deletions.
2 changes: 1 addition & 1 deletion app/components/activities/item_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ See COPYRIGHT and LICENSE files for more details.
<li class="op-activity-list--item-detail"><%= detail %></li>
<% end -%>
<% if time_entry_url.present? -%>
<li class="op-activity-list--item-detail"><%= link_to "Details", @event.event_url %></li>
<li class="op-activity-list--item-detail"><%= link_to I18n.t(:label_details), @event.event_url %></li>
<% end -%>
</ul>
<% elsif noop? -%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ class IndexComponent < ApplicationComponent
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

def initialize(work_package:, filter: :all)
def initialize(work_package:, last_server_timestamp:, filter: :all)
super

@work_package = work_package
@filter = filter
@last_server_timestamp = last_server_timestamp
end

private

attr_reader :work_package, :filter
attr_reader :work_package, :filter, :last_server_timestamp

def wrapper_data_attributes
{
Expand All @@ -59,7 +60,8 @@ def wrapper_data_attributes
"work-packages--activities-tab--index-user-id-value": User.current.id,
"work-packages--activities-tab--index-work-package-id-value": work_package.id,
"work-packages--activities-tab--index-polling-interval-in-ms-value": polling_interval,
"work-packages--activities-tab--index-notification-center-path-name-value": notifications_path
"work-packages--activities-tab--index-notification-center-path-name-value": notifications_path,
"work-packages--activities-tab--index-last-server-timestamp-value": last_server_timestamp
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ def journal_sorting_desc?
end

def journals
work_package.journals.includes(:user, :notifications).reorder(version: journal_sorting)
work_package
.journals
.includes(:user, :notifications)
.reorder(version: journal_sorting)
.with_sequence_version
end

def journal_with_notes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if show_comment_container?
journal_container.with_row do
render(border_box_container(
id: "activity-anchor-#{journal.version}",
id: "activity-anchor-#{journal.sequence_version}",
padding: :condensed,
"aria-label": I18n.t("activities.work_packages.activity_tab.commented")
)) do |border_box_component|
Expand Down Expand Up @@ -52,10 +52,10 @@
data: {
turbo: false,
action: "click->work-packages--activities-tab--index#setAnchor:prevent",
"work-packages--activities-tab--index-id-param": journal.version
"work-packages--activities-tab--index-id-param": journal.sequence_version
}
)) do
"##{journal.version}"
"##{journal.sequence_version}"
end
end
header_end_container.with_column(ml: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def activity_url
end

def activity_anchor
"#activity-#{journal.version}"
"#activity-#{journal.sequence_version}"
end

def updated?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def render_details_header(details_container)
flex_layout: true,
justify_content: :space_between,
classes: "work-packages-activities-tab-journals-item-component-details--journal-details-header-container",
id: "activity-anchor-#{journal.version}"
id: "activity-anchor-#{journal.sequence_version}"
) do |header_container|
render_header_start(header_container)
render_header_end(header_container)
Expand Down Expand Up @@ -192,9 +192,9 @@ def render_activity_link(container)
underline: false,
font_size: :small,
data: { turbo: false, action: "click->work-packages--activities-tab--index#setAnchor:prevent",
"work-packages--activities-tab--index-id-param": journal.version }
"work-packages--activities-tab--index-id-param": journal.sequence_version }
)) do
"##{journal.version}"
"##{journal.sequence_version}"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%=
component_wrapper do
if grouped_emoji_reactions.present?
flex_layout(test_selector: "emoji-reactions") do |reactions_container|
flex_layout(test_selector: "emoji-reactions", flex_wrap: :wrap, classes: "op-emoji-reactions--gap") do |reactions_container|
grouped_emoji_reactions.each do |reaction, data|
reactions_container.with_column(mr: 2) do
render(Primer::Beta::Button.new(
Expand All @@ -12,10 +12,10 @@
test_selector: "reaction-#{reaction}",
tag: :a,
href: href(reaction:),
data: {
turbo_stream: true,
data: {
turbo_stream: true,
turbo_method: :put,
"work-packages--activities-tab--index-target": "reactionButton",
"work-packages--activities-tab--index-target": "reactionButton"
},
aria: { label: aria_label_text(reaction, data[:users]) },
disabled: current_user_cannot_react?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.op-emoji-reactions--gap
row-gap: var(--base-size-4, 4px)

.op-reactions-button:disabled
cursor: default
background-color: transparent
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if journal.notes.present?
flex_layout do |journal_container|
journal_container.with_row do
render(Primer::Box.new(mt: 1)) do
render(Primer::Box.new(mt: 1, classes: "op-uc-container")) do
format_text(journal, :notes)
end
end
Expand Down
27 changes: 23 additions & 4 deletions app/controllers/work_packages/activities_tab_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ def index
render(
WorkPackages::ActivitiesTab::IndexComponent.new(
work_package: @work_package,
filter: @filter
filter: @filter,
last_server_timestamp: get_current_server_timestamp
),
layout: false
)
end

def update_streams
set_last_server_timestamp_to_headers

perform_update_streams_from_last_update_timestamp

respond_with_turbo_streams
Expand Down Expand Up @@ -115,6 +118,7 @@ def create
call = create_journal_service_call

if call.success? && call.result
set_last_server_timestamp_to_headers
handle_successful_create_call(call)
else
handle_failed_create_call(call) # errors should be rendered in the form
Expand Down Expand Up @@ -213,7 +217,9 @@ def find_project
end

def find_journal
@journal = Journal.find(params[:id])
@journal = Journal
.with_sequence_version
.find(params[:id])
rescue ActiveRecord::RecordNotFound
respond_with_error(I18n.t("label_not_found"))
end
Expand Down Expand Up @@ -284,7 +290,8 @@ def replace_whole_tab
replace_via_turbo_stream(
component: WorkPackages::ActivitiesTab::IndexComponent.new(
work_package: @work_package,
filter: @filter
filter: @filter,
last_server_timestamp: get_current_server_timestamp
)
)
end
Expand All @@ -309,7 +316,9 @@ def create_journal_service_call
end

def generate_time_based_update_streams(last_update_timestamp)
journals = @work_package.journals
journals = @work_package
.journals
.with_sequence_version

if @filter == :only_comments
journals = journals.where.not(notes: "")
Expand Down Expand Up @@ -427,4 +436,14 @@ def grouped_emoji_reactions_for_journal
def allowed_to_edit?(journal)
journal.editable_by?(User.current)
end

def get_current_server_timestamp
# single source of truth for the server timestamp format
Time.current.iso8601(3)
end

def set_last_server_timestamp_to_headers
# Add server timestamp to response in order to let the client be in sync with the server
response.headers["X-Server-Timestamp"] = get_current_server_timestamp
end
end
4 changes: 4 additions & 0 deletions app/models/journal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class Journal < ApplicationRecord

has_many :notifications, dependent: :destroy

include ::Scopes::Scoped

scopes :with_sequence_version

# Scopes to all journals excluding the initial journal - useful for change
# logs like the history on issue#show
scope :changing, -> { where(["version > 1"]) }
Expand Down
55 changes: 55 additions & 0 deletions app/models/journals/scopes/with_sequence_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2010-2024 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.
# ++

module Journals::Scopes
module WithSequenceVersion
extend ActiveSupport::Concern

class_methods do
def with_sequence_version
joins(
<<~SQL.squish
JOIN LATERAL (
SELECT
journals_rank.id,
ROW_NUMBER() OVER (ORDER BY version ASC) sequence_version
FROM
journals journals_rank
WHERE
journals_rank.journable_id = journals.journable_id
AND
journals_rank.journable_type = journals.journable_type
) ranked
ON ranked.id = journals.id
SQL
)
.select("*")
end
end
end
end
3 changes: 1 addition & 2 deletions app/models/queries/versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module Queries::Versions
::Queries::Register.register(VersionQuery) do
filter Filters::SharingFilter

order Orders::NameOrder
order Orders::SemverNameOrder
order Orders::DefaultOrder
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,20 @@
# See COPYRIGHT and LICENSE files for more details.
#++

class Queries::Versions::Orders::NameOrder < Queries::Orders::Base
class Queries::Versions::Orders::DefaultOrder < Queries::Orders::Base
self.model = Version

def self.key
:name
/\A(id|name|semver_name)\z/
end

private
def initialize(attribute)
if attribute == :semver_name
OpenProject::Deprecation.warn("Sorting by semver_name is deprecated, name should be used instead")

def order
ordered = Version.order(:name)

if direction == :desc
ordered = ordered.reverse_order
super(:name)
else
super
end

ordered
end
end
9 changes: 2 additions & 7 deletions app/models/queries/work_packages/selects/property_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def caption
},
parent: {
association: "ancestors_relations",
default_order: "asc",
sortable: false
},
status: {
Expand Down Expand Up @@ -96,18 +95,14 @@ def caption
version: {
association: "version",
sortable: "name",
default_order: "ASC",
null_handling: "NULLS LAST",
groupable: "#{WorkPackage.table_name}.version_id"
},
start_date: {
sortable: "#{WorkPackage.table_name}.start_date",
null_handling: "NULLS LAST"
sortable: "#{WorkPackage.table_name}.start_date"
},
due_date: {
highlightable: true,
sortable: "#{WorkPackage.table_name}.due_date",
null_handling: "NULLS LAST"
sortable: "#{WorkPackage.table_name}.due_date"
},
estimated_hours: {
sortable: "#{WorkPackage.table_name}.estimated_hours",
Expand Down
4 changes: 2 additions & 2 deletions config/locales/crowdin/js-af.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ af:
learn_about: "Learn more about the new features"
#Include the version to invalidate outdated translations in other locales.
#Otherwise, e.g. chinese might still have the translations for 10.0 in the 12.0 release.
"14_6":
"15_0":
standard:
new_features_html: >
The release brings various features and improvements for you, e.g. <br> <ul class="%{list_styling_class}"> <li>Benefit from more flexible progress reporting – thanks to user feedback.</li> <li>Receive an update notification with reload option for meetings.</li> <li>Enable a custom field for multiple projects at once.</li> <li>Use relative work package attribute macros.</li> <li>Show empty lines in saved rich text.</li> <li>See past meetings included in the number next to the Meetings tab.</li> </ul>
The release brings various features and improvements for you, e.g. <br> <ul class="%{list_styling_class}"> <li>Boost your communication with a better structured Activity tab, real-time loading messages and notifications, emoji reactions, and more.</li> <li>Benefit from easy Single Sign-On authentication settings with SAML and OIDC in your Enterprise Cloud administration.</li> <li>Use the new 'Standard global role' and enable permissions to view email addresses.</li> <li>Enjoy easier navigation in project lists with quick action table headers.</li> <li>Experience simplified design settings with fewer sidebar design variables needed.</li> <li>Reduce manual cleanup when adding a custom field to a type – no more auto-applying to all projects.</li> <li>Benefit from improved navigation clarity – 'My account' is renamed to 'Account settings'.</li> </ul>
ical_sharing_modal:
title: "Subscribe to calendar"
inital_setup_error_message: "An error occured while fetching data."
Expand Down
4 changes: 2 additions & 2 deletions config/locales/crowdin/js-ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ ar:
learn_about: "Learn more about the new features"
#Include the version to invalidate outdated translations in other locales.
#Otherwise, e.g. chinese might still have the translations for 10.0 in the 12.0 release.
"14_6":
"15_0":
standard:
new_features_html: >
The release brings various features and improvements for you, e.g. <br> <ul class="%{list_styling_class}"> <li>Benefit from more flexible progress reporting – thanks to user feedback.</li> <li>Receive an update notification with reload option for meetings.</li> <li>Enable a custom field for multiple projects at once.</li> <li>Use relative work package attribute macros.</li> <li>Show empty lines in saved rich text.</li> <li>See past meetings included in the number next to the Meetings tab.</li> </ul>
The release brings various features and improvements for you, e.g. <br> <ul class="%{list_styling_class}"> <li>Boost your communication with a better structured Activity tab, real-time loading messages and notifications, emoji reactions, and more.</li> <li>Benefit from easy Single Sign-On authentication settings with SAML and OIDC in your Enterprise Cloud administration.</li> <li>Use the new 'Standard global role' and enable permissions to view email addresses.</li> <li>Enjoy easier navigation in project lists with quick action table headers.</li> <li>Experience simplified design settings with fewer sidebar design variables needed.</li> <li>Reduce manual cleanup when adding a custom field to a type – no more auto-applying to all projects.</li> <li>Benefit from improved navigation clarity – 'My account' is renamed to 'Account settings'.</li> </ul>
ical_sharing_modal:
title: "Subscribe to calendar"
inital_setup_error_message: "An error occured while fetching data."
Expand Down
4 changes: 2 additions & 2 deletions config/locales/crowdin/js-az.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ az:
learn_about: "Learn more about the new features"
#Include the version to invalidate outdated translations in other locales.
#Otherwise, e.g. chinese might still have the translations for 10.0 in the 12.0 release.
"14_6":
"15_0":
standard:
new_features_html: >
The release brings various features and improvements for you, e.g. <br> <ul class="%{list_styling_class}"> <li>Benefit from more flexible progress reporting – thanks to user feedback.</li> <li>Receive an update notification with reload option for meetings.</li> <li>Enable a custom field for multiple projects at once.</li> <li>Use relative work package attribute macros.</li> <li>Show empty lines in saved rich text.</li> <li>See past meetings included in the number next to the Meetings tab.</li> </ul>
The release brings various features and improvements for you, e.g. <br> <ul class="%{list_styling_class}"> <li>Boost your communication with a better structured Activity tab, real-time loading messages and notifications, emoji reactions, and more.</li> <li>Benefit from easy Single Sign-On authentication settings with SAML and OIDC in your Enterprise Cloud administration.</li> <li>Use the new 'Standard global role' and enable permissions to view email addresses.</li> <li>Enjoy easier navigation in project lists with quick action table headers.</li> <li>Experience simplified design settings with fewer sidebar design variables needed.</li> <li>Reduce manual cleanup when adding a custom field to a type – no more auto-applying to all projects.</li> <li>Benefit from improved navigation clarity – 'My account' is renamed to 'Account settings'.</li> </ul>
ical_sharing_modal:
title: "Subscribe to calendar"
inital_setup_error_message: "An error occured while fetching data."
Expand Down
Loading

0 comments on commit 7f3e779

Please sign in to comment.