OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Merge branch 'feature/54733-primerise-the-activity-panel' into feature/40437-emoji-reactions-to-work-package-comments
jjabari-op560d7f91da16
diff --cc app/controllers/work_packages/activities_tab_controller.rbindex 7e5a0165034,11087e726b3..0958ce69439--- a/app/controllers/work_packages/activities_tab_controller.rb+++ b/app/controllers/work_packages/activities_tab_controller.rb@@@ -33,7 -33,7 +33,7 @@@ class WorkPackages::ActivitiesTabControbefore_action :find_work_packagebefore_action :find_project- before_action :find_journal, only: %i[edit cancel_edit update toggle_reaction]- before_action :find_journal, only: %i[edit cancel_edit update toggle_notification_read_status]++ before_action :find_journal, only: %i[edit cancel_edit update toggle_reaction toggle_notification_read_status]before_action :set_filterbefore_action :authorize@@@ -154,36 -153,23 +154,53 @@@respond_with_turbo_streamsend+ def toggle_reaction+ call = if @journal.emoji_reactions.exists?(user: User.current, emoji: params[:emoji])+ EmojiReactions::DeleteService.new(+ user: User.current,+ model: @journal.emoji_reactions.find_by(user: User.current, emoji: params[:emoji])+ ).call+ else+ EmojiReactions::CreateService.new(+ user: User.current+ ).call(+ user: User.current,+ reactable: @journal,+ emoji: params[:emoji]+ )+ end++ if call.success?+ update_via_turbo_stream(+ component: WorkPackages::ActivitiesTab::Journals::ItemComponent::Show.new(+ journal: @journal,+ filter: params[:filter]&.to_sym || :all+ )+ )+ else+ # TODO: handle errors+ end++ respond_with_turbo_streams+ end++ def toggle_notification_read_status+ notification = Notification.find_by(recipient: User.current, journal: @journal)++ call = Notifications::UpdateService.new(model: notification, user: User.current).call(+ read_ian: !notification.read_ian+ )++ if call.success?+ update_item_component(@journal.reload, state: :show)+ update_activity_counter+ else+ handle_failed_update_call(call)+ end-+++ respond_with_turbo_streams+ end+privatedef respond_with_error(error_message)@@@ -353,19 -328,28 +360,41 @@@endend+ def generate_time_based_reaction_update_streams(last_update_timestamp)+ # Current limitation: Only shows added reactions, not removed ones+ EmojiReaction+ .where(reactable_id: @work_package.journal_ids)+ .where("updated_at > ?", last_update_timestamp).find_each do |reaction|+ update_via_turbo_stream(+ component: WorkPackages::ActivitiesTab::Journals::ItemComponent::Reactions.new(+ journal: reaction.reactable+ )+ )+ end+ end++ def rerender_updated_journals(journals, last_update_timestamp)+ journals.where("updated_at > ?", last_update_timestamp).find_each do |journal|+ # we need to update the whole component as the show part is not rendered for journals which originally have no notes+ update_journal_item(journal:)+ end+ end++ def rerender_journals_with_updated_notification(journals, last_update_timestamp)+ journals+ .joins(:notifications)+ .where("notifications.updated_at > ?", last_update_timestamp)+ .find_each do |journal|+ update_journal_item(journal:)+ end+ end++ def append_or_prepend_new_journals(journals, last_update_timestamp)+ journals.where("created_at > ?", last_update_timestamp).find_each do |journal|+ append_or_prepend_latest_journal_via_turbo_stream(journal)+ end+ end+def append_or_prepend_latest_journal_via_turbo_stream(journal)target_component = WorkPackages::ActivitiesTab::Journals::IndexComponent.new(work_package: @work_package,diff --cc config/routes.rbindex 2c033c1722e,aeba8365da0..d28f8173ea2--- a/config/routes.rb+++ b/config/routes.rb@@@ -577,10 -577,11 +577,12 @@@ Rails.application.routes.draw d# states managed by client-side routing on work_package#indexget "details/*state" => "work_packages#index", on: :collection, as: :details- resources :activities, controller: "work_packages/activities_tab", only: %i[index create edit update] do+ resources :activities, controller: "work_packages/activities_tab",+ only: %i[index create edit update] domember doget :cancel_edit+ put :toggle_reaction+ put :toggle_notification_read_statusendcollection doget :update_streams