Skip to content

Commit

Permalink
Show changed start times for occurrences
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmir committed Nov 29, 2024
1 parent c62cf70 commit a657f79
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions modules/meeting/app/components/recurring_meetings/row_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,30 @@ def start_time
end
end

def user_start_time_value
@user_start_time_value ||= helpers.in_current_user_zone(model.start_time)
def user_time_zone(time)
helpers.in_current_user_zone(time)
end

def formatted_time(time)
helpers.format_time(user_time_zone(time), include_date: true)
end

def old_time
render(Primer::Beta::Text.new(tag: :s)) { formatted_time(model.start_time) }
end

def start_time_title
helpers.format_time(user_start_time_value, include_date: true)
if start_time_changed?
"#{old_time}\n#{formatted_time(meeting.start_time)}".html_safe # rubocop:disable Rails/OutputSafety
else
formatted_time(model.start_time)
end
end

def relative_time
render(OpPrimer::RelativeTimeComponent.new(datetime: user_start_time_value, prefix: I18n.t(:label_on)))
time = start_time_changed? ? meeting.start_time : model.start_time

render(OpPrimer::RelativeTimeComponent.new(datetime: user_time_zone(time), prefix: I18n.t(:label_on)))
end

def last_edited
Expand Down Expand Up @@ -190,5 +204,9 @@ def delete_allowed?
def copy_allowed?
User.current.allowed_in_project?(:create_meetings, project)
end

def start_time_changed?
meeting && meeting.start_time != model.start_time
end
end
end

0 comments on commit a657f79

Please sign in to comment.