use current user for meeting content update

pull/9776/head
ulferts 3 years ago
parent 32a19b622e
commit 313749af88
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 2
      modules/meeting/app/controllers/meeting_contents_controller.rb
  2. 2
      modules/meeting/app/controllers/meetings_controller.rb
  3. 4
      modules/meeting/app/models/meeting.rb
  4. 5
      modules/meeting/app/models/meeting_agenda.rb
  5. 18
      modules/meeting/app/models/meeting_content.rb
  6. 2
      modules/meeting/app/views/meeting_contents/_form.html.erb
  7. 3
      modules/meeting/config/locales/en.yml

@ -138,6 +138,6 @@ class MeetingContentsController < ApplicationController
end
def content_params
params.require(@content_type).permit(:text, :lock_version, :comment)
params.require(@content_type).permit(:text, :lock_version, :journal_notes)
end
end

@ -68,7 +68,7 @@ class MeetingsController < ApplicationController
if params[:copied_from_meeting_id].present? && params[:copied_meeting_agenda_text].present?
@meeting.agenda = MeetingAgenda.new(
text: params[:copied_meeting_agenda_text],
comment: "Copied from Meeting ##{params[:copied_from_meeting_id]}"
journal_notes: I18n.t('meeting.copied', id: params[:copied_from_meeting_id])
)
@meeting.agenda.author = User.current
end

@ -180,7 +180,9 @@ class Meeting < ApplicationRecord
attachments = agenda.attachments.map { |a| [a, a.copy] }
original_text = String(agenda.text)
minutes = create_minutes(text: original_text, comment: 'Minutes created', attachments: attachments.map(&:last))
minutes = create_minutes(text: original_text,
journal_notes: I18n.t('events.meeting_minutes_created'),
attachments: attachments.map(&:last))
# substitute attachment references in text to use the respective copied attachments
updated_text = original_text.gsub(/(?<=\(\/api\/v3\/attachments\/)\d+(?=\/content\))/) do |id|

@ -27,16 +27,15 @@
#++
class MeetingAgenda < MeetingContent
# TODO: internationalize the comments
def lock!(user = User.current)
self.comment = 'Agenda closed'
self.journal_notes = I18n.t('events.meeting_agenda_closed')
self.author = user
self.locked = true
save
end
def unlock!(user = User.current)
self.comment = 'Agenda opened'
self.journal_notes = I18n.t('events.meeting_agenda_opened')
self.author = user
self.locked = false
save

@ -31,13 +31,7 @@ class MeetingContent < ApplicationRecord
include OpenProject::Journal::AttachmentHelper
belongs_to :meeting
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
attr_accessor :comment
validates_length_of :comment, maximum: 255, allow_nil: true
before_save :comment_to_journal_notes
belongs_to :author, class_name: 'User'
acts_as_attachable(
after_remove: :attachments_changed,
@ -77,13 +71,5 @@ class MeetingContent < ApplicationRecord
end
# Show the project on activity and search views
def project
meeting.project
end
private
def comment_to_journal_notes
add_journal(author, comment) unless changes.empty?
end
delegate :project, to: :meeting
end

@ -47,7 +47,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= f.hidden_field :lock_version %>
<% path = send("preview_#{content_type}_path", content.meeting) %>
<p><%= f.text_field :comment, :size => 120 %></p>
<p><%= f.text_field :journal_notes, label: :comments %></p>
<p><%= styled_button_tag t(:button_save), class: '-highlight -with-icon icon-checkmark button--save-agenda' %>
<%= link_to t(:button_cancel), "#", data: { 'content-type': content_type }, class: 'button -with-icon icon-cancel button--cancel-agenda' %>
<% end %>

@ -75,6 +75,9 @@ en:
label_time_zone: "Time zone"
label_start_date: "Start date"
meeting:
copied: "Copied from Meeting #%{id}"
notice_successful_notification: "Notification sent successfully"
notice_timezone_missing: No time zone is set and %{zone} is assumed. To choose your time zone, please click here.

Loading…
Cancel
Save