Skip to content

Commit

Permalink
Differentiate activity events by controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmir committed Mar 18, 2024
1 parent c102ddd commit 1a34024
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
10 changes: 5 additions & 5 deletions app/components/activities/item_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ def meeting_agenda_item?
end

def meeting_activity?
# need to check if the activities are coming from the meetings controller and not the activities controller
# event.provider?
@event.controller_flag && !@event.journal.initial?
end

def initial_agenda_item?
Expand Down Expand Up @@ -153,13 +152,14 @@ def agenda_item_title # rubocop:disable Metrics/AbcSize
if agenda_item.item_type == "work_package"
link_to agenda_item.work_package.to_s, agenda_item.work_package
else
"Agenda item \"#{agenda_item.title}\"" # needs i18n
I18n.t("text_agenda_item_title", title: agenda_item.title)
end
rescue ActiveRecord::RecordNotFound
"Agenda item \"#{@event.meeting_agenda_item_data.last['title'].last || @event.meeting_agenda_item_data.last['title'].first}\""
agenda_item_title_field = @event.meeting_agenda_item_data.last['title']
I18n.t("text_agenda_item_title", title: agenda_item_title_field.last || agenda_item_title_field.first)
end

def meeting_activity_title
"Meeting details"
I18n.t("label_meeting_details")
end
end
1 change: 1 addition & 0 deletions app/models/activities/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module Activities
:event_type,
:event_path,
:event_url,
:controller_flag,
:meeting_agenda_item_data,
# attributes below are eager loaded by Activities::Fetcher
:event_author,
Expand Down
8 changes: 5 additions & 3 deletions modules/meeting/app/controllers/meetings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def show
end
end

def create
def create # rubocop:disable Metrics/AbcSize
@meeting.participants.clear # Start with a clean set of participants
@meeting.participants_attributes = @converted_params.delete(:participants_attributes)
@meeting.attributes = @converted_params
Expand All @@ -86,7 +86,7 @@ def create
link = I18n.t(:notice_timezone_missing, zone: Time.zone)
text += " #{view_context.link_to(link, { controller: '/my', action: :account }, class: 'link_to_profile')}"
end
flash[:notice] = text.html_safe
flash[:notice] = text.html_safe # rubocop:disable Rails/OutputSafety

redirect_to action: 'show', id: @meeting
else
Expand Down Expand Up @@ -421,6 +421,8 @@ def separate_events_for_history # rubocop:disable Metrics/AbcSize,Metrics/Percei

agenda_item_only_check(event, events_dup, details_count)
end

event.controller_flag = true
end

@events = events_dup
Expand Down Expand Up @@ -450,7 +452,7 @@ def find_copy_from_meeting
render_404
end

def copy_meeting_agenda
def copy_meeting_agenda # rubocop:disable Metrics/AbcSize
return unless params[:copy_agenda] == '1' && @copy_from

if @meeting.is_a?(StructuredMeeting)
Expand Down
2 changes: 2 additions & 0 deletions modules/meeting/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ en:
label_agenda_item_move_down: "Move down"
label_agenda_item_add_notes: "Add notes"

text_agenda_item_title: 'Agenda item "%{title}"'

label_meeting_details: "Meeting details"
label_meeting_details_edit: "Edit meeting details"

Expand Down

0 comments on commit 1a34024

Please sign in to comment.