OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
more feature updates
Klaus Zanders4688953e8a82
diff --git a/modules/costs/app/components/time_entries/activity_form.rb b/modules/costs/app/components/time_entries/activity_form.rbindex af491adc59c..bdb7bfcaf03 100644--- a/modules/costs/app/components/time_entries/activity_form.rb+++ b/modules/costs/app/components/time_entries/activity_form.rb@@ -41,7 +41,7 @@ module TimeEntriesfocusDirectly: false,multiple: false,decorated: true,- disabled: !project_or_work_package_selected?,+ disabled: project_or_entity_selected?,append_to: "#time-entry-dialog"}) do |select|diff --git a/modules/costs/app/controllers/my/time_tracking_controller.rb b/modules/costs/app/controllers/my/time_tracking_controller.rbindex 1532352dea8..4ac0ddd43f7 100644--- a/modules/costs/app/controllers/my/time_tracking_controller.rb+++ b/modules/costs/app/controllers/my/time_tracking_controller.rb@@ -123,7 +123,7 @@ module Mydef load_time_entries(time_scope)@time_entries = TimeEntry- .includes(:project, :activity, { work_package: :status })+ .preload(:project, :activity, :entity).where(project_id: Project.visible.select(:id)).where(user: User.current, spent_on: time_scope, ongoing: false).order(:spent_on, :start_time, :hours)diff --git a/modules/costs/app/models/activities/time_entry_activity_provider.rb b/modules/costs/app/models/activities/time_entry_activity_provider.rbindex b2ac29e59c7..d7804610c16 100644--- a/modules/costs/app/models/activities/time_entry_activity_provider.rb+++ b/modules/costs/app/models/activities/time_entry_activity_provider.rb@@ -96,7 +96,7 @@ class Activities::TimeEntryActivityProvider < Activities::BaseActivityProviderdef event_location(event, only_path: true)filter_params = if event["entity_type"] == "WorkPackage"work_package_id_filter(event["entity_id"])- # TODO: Add meeeing here?+ # TODO: Add meeting here?elseproject_id_filter(event["project_id"])enddiff --git a/modules/costs/app/models/time_entry.rb b/modules/costs/app/models/time_entry.rbindex 8a82d8e69ef..39e1516380f 100644--- a/modules/costs/app/models/time_entry.rb+++ b/modules/costs/app/models/time_entry.rb@@ -145,7 +145,7 @@ class TimeEntry < ApplicationRecord# Returns true if the time entry can be edited by usr, otherwise falsedef editable_by?(usr)- (usr == user && usr.allowed_in_work_package?(:edit_own_time_entries, work_package)) ||+ (usr == user && entity.is_a?(WorkPackage) && usr.allowed_in_work_package?(:edit_own_time_entries, entity)) ||usr.allowed_in_project?(:edit_time_entries, project)end@@ -155,7 +155,7 @@ class TimeEntry < ApplicationRecorddef visible_by?(usr)usr.allowed_in_project?(:view_time_entries, project) ||- (user_id == usr.id && usr.allowed_in_work_package?(:view_own_time_entries, work_package))+ (user_id == usr.id && entity.is_a?(WorkPackage) && usr.allowed_in_work_package?(:view_own_time_entries, entity))enddef costs_visible_by?(usr)diff --git a/modules/costs/lib/full_calendar/time_entry_event.rb b/modules/costs/lib/full_calendar/time_entry_event.rbindex 1a4b89eb564..266c03c4f77 100644--- a/modules/costs/lib/full_calendar/time_entry_event.rb+++ b/modules/costs/lib/full_calendar/time_entry_event.rb@@ -39,7 +39,7 @@ module FullCalendarstarts_at: time_entry.start_timestamp || time_entry.spent_on,ends_at: time_entry.end_timestamp || time_entry.spent_on,all_day: time_entry.start_time.blank?,- title: "#{time_entry.project.name}: ##{time_entry.work_package.id} #{time_entry.work_package.subject}"+ title: "#{time_entry.project.name}: ##{time_entry.entity.id} #{time_entry.entity.subject}")event.time_entry = time_entry@@ -50,9 +50,9 @@ module FullCalendardef additional_attributes{hours: time_entry.hours,- typeId: time_entry.work_package.type_id,- workPackageId: time_entry.work_package.id,- workPackageSubject: time_entry.work_package.subject,+ typeId: time_entry.entity.type_id,+ workPackageId: time_entry.entity.id,+ workPackageSubject: time_entry.entity.subject,projectId: time_entry.project.id,projectName: time_entry.project.name}diff --git a/modules/dashboards/spec/features/time_entries_spec.rb b/modules/dashboards/spec/features/time_entries_spec.rbindex c4083285ee1..99e80dded10 100644--- a/modules/dashboards/spec/features/time_entries_spec.rb+++ b/modules/dashboards/spec/features/time_entries_spec.rb@@ -38,7 +38,7 @@ RSpec.describe "Time entries widget on dashboard", :js, :with_cuprite dolet!(:other_work_package) { create(:work_package, project: other_project, type:, author: user) }let!(:visible_time_entry) docreate(:time_entry,- work_package:,+ entity: work_package,project:,user:,spent_on: Time.zone.today,@@ -47,7 +47,7 @@ RSpec.describe "Time entries widget on dashboard", :js, :with_cuprite doendlet!(:other_visible_time_entry) docreate(:time_entry,- work_package:,+ entity: work_package,project:,user: other_user,spent_on: 1.day.ago.to_date,@@ -56,7 +56,7 @@ RSpec.describe "Time entries widget on dashboard", :js, :with_cuprite doendlet!(:invisible_time_entry) docreate(:time_entry,- work_package: other_work_package,+ entity: other_work_package,project: other_project,user:,hours: 4)diff --git a/spec/features/activities/time_entry_activity_spec.rb b/spec/features/activities/time_entry_activity_spec.rbindex 03e279655a6..46df56f29b7 100644--- a/spec/features/activities/time_entry_activity_spec.rb+++ b/spec/features/activities/time_entry_activity_spec.rb@@ -52,7 +52,7 @@ RSpec.describe "TimeEntry activity",let!(:time_entry) docreate(:time_entry,project:,- work_package:,+ entity: work_package,spent_on: Time.zone.today,hours: 5,user:,@@ -86,7 +86,7 @@ RSpec.describe "TimeEntry activity",old_spent_on = time_entry.spent_onnew_attributes = {- work_package: work_package2,+ entity: work_package2,spent_on: Time.zone.yesterday,hours: 1.0,user: user2,diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rbindex 43e468d7f68..ed031a45efa 100644--- a/spec/features/support/components/time_logging_modal.rb+++ b/spec/features/support/components/time_logging_modal.rb@@ -131,7 +131,7 @@ module Componentsenddef update_field(field_name, value)- if field_name.in?(%w[work_package_id user_id activity_id])+ if field_name.in?(%w[entity_id user_id activity_id])select_autocomplete modal_container.find("#time_entry_#{field_name}"),query: value,select_text: value,@@ -144,18 +144,6 @@ module Componentsendend- def update_work_package_field(value, recent = false)- work_package_field.input_element.click-- if recent- within(".ng-dropdown-header") do- click_link(I18n.t("js.label_recent"))- end- end-- work_package_field.set_value(value)- end-def perform_action(action)within modal_container doclick_button action@@ -177,7 +165,7 @@ module Componentsenddef has_hidden_work_package_field_for(work_package)- expect(modal_container).to have_field "input#time_entry_work_package_id",+ expect(modal_container).to have_field "input#time_entry_entity_id",with: work_package.id,type: :hiddenenddiff --git a/spec/features/work_packages/display_fields/spent_time_display_spec.rb b/spec/features/work_packages/display_fields/spent_time_display_spec.rbindex 3894cafa0ec..8e557ee3147 100644--- a/spec/features/work_packages/display_fields/spent_time_display_spec.rb+++ b/spec/features/work_packages/display_fields/spent_time_display_spec.rb@@ -49,7 +49,7 @@ RSpec.describe "Logging time within the work package view", :js, :with_cuprite d# the fields are visibletime_logging_modal.has_field_with_value "spent_on", Time.zone.today.strftime("%Y-%m-%d")- time_logging_modal.shows_field "work_package_id", false+ time_logging_modal.shows_field "entity_id", falsetime_logging_modal.shows_field "user_id", user_field_visible# Update the fields@@ -88,7 +88,7 @@ RSpec.describe "Logging time within the work package view", :js, :with_cuprite dspent_time_field.expect_display_value "1h"TimeEntry.last.tap do |te|- expect(te.work_package).to eq(work_package)+ expect(te.entity).to eq(work_package)expect(te.project).to eq(project)expect(te.activity).to eq(activity)expect(te.user).to eq(user)