diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-07-21 01:45:58 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:44:01 -0500 |
commit | 2d33ad80c05203e69f42a26814aeb745bf48d064 (patch) | |
tree | e20b881a13fd677ecafa8da522d524a7bdeadf98 | |
parent | 263ead73616dba43a0337c2a3edaf96a6382d533 (diff) |
[Feature] Add text commands and various aliases for thread (un)hiding: #!hide, #!unhide, #!hide_thread, #!unhide_thread
-rw-r--r-- | app/lib/command_tag/commands/status_tools.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/app/lib/command_tag/commands/status_tools.rb b/app/lib/command_tag/commands/status_tools.rb index 3c6d7137e..d3b4cd005 100644 --- a/app/lib/command_tag/commands/status_tools.rb +++ b/app/lib/command_tag/commands/status_tools.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# rubocop:disable Layout/ExtraSpacing module CommandTag::Commands::StatusTools def handle_publish_once_at_end return unless author_of_parent? && !@parent.published? @@ -7,6 +8,11 @@ module CommandTag::Commands::StatusTools PublishStatusService.new.call(@parent) end + alias handle_publish_post_once_at_end handle_publish_once_at_end + alias handle_publish_roar_once_at_end handle_publish_once_at_end + alias handle_publish_toot_once_at_end handle_publish_once_at_end + alias handle_publish_parent_once_at_end handle_publish_once_at_end + def handle_edit_once_before_save return unless author_of_parent? @@ -15,4 +21,48 @@ module CommandTag::Commands::StatusTools UpdateStatusService.new.call(@parent, params) destroy_status! end + + alias handle_edit_post_once_before_save handle_edit_once_before_save + alias handle_edit_roar_once_before_save handle_edit_once_before_save + alias handle_edit_toot_once_before_save handle_edit_once_before_save + alias handle_edit_parent_once_before_save handle_edit_once_before_save + + def handle_mute_once_at_end + return if author_of_parent? + + MuteStatusService.new.call(@account, @parent) + end + + alias handle_mute_post_once_at_end handle_mute_once_at_end + alias handle_mute_roar_once_at_end handle_mute_once_at_end + alias handle_mute_toot_once_at_end handle_mute_once_at_end + alias handle_mute_parent_once_at_end handle_mute_once_at_end + + def handle_unmute_once_at_end + return if author_of_parent? + + @account.unmute_status!(@parent) + end + + alias handle_unmute_post_once_at_end handle_unmute_once_at_end + alias handle_unmute_roar_once_at_end handle_unmute_once_at_end + alias handle_unmute_toot_once_at_end handle_unmute_once_at_end + alias handle_unmute_parent_once_at_end handle_unmute_once_at_end + + def handle_mute_thread_once_at_end + return if author_of_parent? + + MuteConversationService.new.call(@account, @conversation) + end + + alias handle_mute_conversation_once_at_end handle_mute_thread_once_at_end + + def handle_unmute_thread_once_at_end + return if author_of_parent? || @conversation.blank? + + @account.unmute_conversation!(@conversation) + end + + alias handle_unmute_conversation_once_at_end handle_unmute_thread_once_at_end end +# rubocop:enable Layout/ExtraSpacing |