Skip to content

Commit

Permalink
fix time entries endpoint to return ongoing time entries while lackin…
Browse files Browse the repository at this point in the history
…g log own time permission
  • Loading branch information
machisuji authored and oliverguenther committed Mar 6, 2024
1 parent 56ed50b commit 8d69335
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/costs/app/models/time_entries/scopes/ongoing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ def ongoing

def visible_ongoing(user = User.current)
TimeEntry
.where(work_package_id: WorkPackage.allowed_to(user, :log_own_time), user:, ongoing: true)
.where(work_package_id: visible_work_packages(user).select(:id), user:, ongoing: true)
end

def visible_work_packages(user)
WorkPackage.allowed_to(user, :log_own_time).or(
WorkPackage.where(project_id: Project.allowed_to(User.current, :log_time)))
end

def not_ongoing
Expand Down

0 comments on commit 8d69335

Please sign in to comment.