Skip to content

Commit

Permalink
Merge branch 'dev' for release 6.3.36
Browse files Browse the repository at this point in the history
  • Loading branch information
gnepud committed Dec 12, 2024
2 parents 9a26554 + d7d81e3 commit bf0c30b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Next release

## v6.3.36 2024 December 12

- Improvement: default order for the spaces/trainings list is set to descending by created_at
- Improvement: members cannot see training deactivated in the list

## v6.3.35 2024 November 13

- Fix a bug: unable to run rails db:migrate if the database is empty
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/spaces_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class API::SpacesController < API::APIController
respond_to :json

def index
@spaces = Space.includes(:space_image, :machines).where(deleted_at: nil)
@spaces = Space.includes(:space_image, :machines).where(deleted_at: nil).order(:created_at)
@spaces_indexed_with_parent = @spaces.index_with { |space| @spaces.find { |s| s.id == space.parent_id } }
@spaces_grouped_by_parent_id = @spaces.group_by(&:parent_id)
end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/trainings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def index

def show
@training = Training.friendly.find(params[:id])
authorize @training
end

def create
Expand Down
4 changes: 4 additions & 0 deletions app/policies/training_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ def resolve
end
end

def show?
!record.disabled? || user.admin? || user.manager?
end

def create?
user.admin?
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/training_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class TrainingService
class << self
# @param filters [ActionController::Parameters]
def list(filters)
trainings = Training.includes(:training_image, :plans, :machines)
trainings = Training.includes(:training_image, :plans, :machines).order(:created_at)

trainings = filter_by_disabled(trainings, filters)
trainings = filter_by_public_page(trainings, filters)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fab-manager",
"version": "6.3.35",
"version": "6.3.36",
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [
"fablab",
Expand Down

0 comments on commit bf0c30b

Please sign in to comment.