Skip to content

Commit

Permalink
Merge pull request opf#14994 from opf/fix/allow-preview-on-meeting-co…
Browse files Browse the repository at this point in the history
…ntent

Allow previewing on meeting contents
  • Loading branch information
klaustopher authored Mar 19, 2024
2 parents 45182e3 + 4ba81fd commit f80f3fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api/v3/render/render_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class RenderAPI < ::API::OpenProjectAPI

resources :render do
helpers do
SUPPORTED_CONTEXT_NAMESPACES ||= %w(work_packages projects news posts wiki_pages).freeze
SUPPORTED_CONTEXT_NAMESPACES ||= %w(work_packages projects news posts wiki_pages meeting_contents).freeze
SUPPORTED_MEDIA_TYPE ||= 'text/plain'.freeze

def allowed_content_types
Expand Down
6 changes: 6 additions & 0 deletions modules/meeting/app/models/meeting_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ class MeetingContent < ApplicationRecord
title: Proc.new { |o| "#{o.class.model_name.human}: #{o.meeting.title}" },
url: Proc.new { |o| { controller: '/meetings', action: 'show', id: o.meeting } }

scope :visible, ->(*args) {
includes(meeting: :project)
.references(:projects)
.merge(Project.allowed_to(args.first || User.current, :view_meetings))
}

def editable?
true
end
Expand Down

0 comments on commit f80f3fd

Please sign in to comment.