From 5e09f5a9b9ae1a976c8462535393b2948dd9bdb3 Mon Sep 17 00:00:00 2001 From: Jose Farias Date: Mon, 25 Nov 2024 16:17:44 -0600 Subject: [PATCH] Remove swapping --- app/assets/stylesheets/bubbles.css | 4 -- app/assets/stylesheets/comboboxes.css | 13 ------ .../assignments/swaps_controller.rb | 17 -------- app/controllers/taggings/swaps_controller.rb | 21 ---------- app/models/bubble/assignable.rb | 7 ---- app/models/bubble/taggable.rb | 7 ---- config/routes.rb | 2 - .../assignments/swaps_controller_test.rb | 41 ------------------- .../taggings/swaps_controller_test.rb | 41 ------------------- 9 files changed, 153 deletions(-) delete mode 100644 app/controllers/assignments/swaps_controller.rb delete mode 100644 app/controllers/taggings/swaps_controller.rb delete mode 100644 test/controllers/assignments/swaps_controller_test.rb delete mode 100644 test/controllers/taggings/swaps_controller_test.rb diff --git a/app/assets/stylesheets/bubbles.css b/app/assets/stylesheets/bubbles.css index 8bd49c974..e327e8150 100644 --- a/app/assets/stylesheets/bubbles.css +++ b/app/assets/stylesheets/bubbles.css @@ -130,10 +130,6 @@ } } - &:focus-within { - z-index: 2; - } - .avatar { border-radius: var(--bubble-shape); } diff --git a/app/assets/stylesheets/comboboxes.css b/app/assets/stylesheets/comboboxes.css index 3cfce33c9..5c474ea59 100644 --- a/app/assets/stylesheets/comboboxes.css +++ b/app/assets/stylesheets/comboboxes.css @@ -18,16 +18,3 @@ background-color: var(--color-ink-reversed); } } - -.bubble__meta { - .hw-combobox { - position: absolute; - right: 0; - top: -0.25rem; - z-index: 1; - } - - .hw-combobox__main__wrapper { - position: absolute; - } -} diff --git a/app/controllers/assignments/swaps_controller.rb b/app/controllers/assignments/swaps_controller.rb deleted file mode 100644 index 3554a1369..000000000 --- a/app/controllers/assignments/swaps_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Assignments::SwapsController < ApplicationController - include BubbleScoped, BucketScoped - - def create - @bubble.swap_assignment incoming_assignee, outgoing_assignee - redirect_to @bubble - end - - private - def incoming_assignee - @bucket.users.active.find params.expect(:incoming_assignee_id) - end - - def outgoing_assignee - @bucket.users.active.find params.expect(:outgoing_assignee_id) - end -end diff --git a/app/controllers/taggings/swaps_controller.rb b/app/controllers/taggings/swaps_controller.rb deleted file mode 100644 index b335c1a6c..000000000 --- a/app/controllers/taggings/swaps_controller.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Taggings::SwapsController < ApplicationController - include BubbleScoped, BucketScoped - - def create - @bubble.swap_tag incoming_tag, outgoing_tag - redirect_to @bubble - end - - private - def incoming_tag - if params[:incoming_tag_title] - Tag.new title: params[:incoming_tag_title] - else - Current.account.tags.find params.expect(:incoming_tag_id) - end - end - - def outgoing_tag - Current.account.tags.find params.expect(:outgoing_tag_id) - end -end diff --git a/app/models/bubble/assignable.rb b/app/models/bubble/assignable.rb index 5bcd241fd..128d76e5b 100644 --- a/app/models/bubble/assignable.rb +++ b/app/models/bubble/assignable.rb @@ -22,13 +22,6 @@ module Bubble::Assignable track_event :unassigned, assignee_ids: [ user.id ] if destructions.any? end - def swap_assignment(incoming, outgoing) - transaction do - unassign outgoing - assign incoming unless incoming == outgoing - end - end - def toggle_assignment(user) assigned_to?(user) ? unassign(user) : assign(user) end diff --git a/app/models/bubble/taggable.rb b/app/models/bubble/taggable.rb index d32e58a27..0ab168fce 100644 --- a/app/models/bubble/taggable.rb +++ b/app/models/bubble/taggable.rb @@ -18,13 +18,6 @@ module Bubble::Taggable taggings.destroy_by tag: tag end - def swap_tag(incoming, outgoing) - transaction do - untag outgoing - tag incoming unless incoming == outgoing - end - end - def toggle_tag(tag) tagged_with?(tag) ? untag(tag) : tag(tag) end diff --git a/config/routes.rb b/config/routes.rb index fd1d318ce..ebddd9256 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -29,12 +29,10 @@ Rails.application.routes.draw do end namespace :assignments, as: :assignment do - resources :swaps resources :toggles end namespace :taggings, as: :tagging do - resources :swaps resources :toggles end end diff --git a/test/controllers/assignments/swaps_controller_test.rb b/test/controllers/assignments/swaps_controller_test.rb deleted file mode 100644 index 00c9b1a89..000000000 --- a/test/controllers/assignments/swaps_controller_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -require "test_helper" - -class Assignments::SwapsControllerTest < ActionDispatch::IntegrationTest - setup do - sign_in_as :kevin - end - - test "swap with same user" do - assert_changes "bubbles(:logo).assigned_to?(users(:kevin))", from: true, to: false do - post bucket_bubble_assignment_swaps_url(buckets(:writebook), bubbles(:logo)), params: { - incoming_assignee_id: users(:kevin).id, - outgoing_assignee_id: users(:kevin).id - } - end - assert_redirected_to bubbles(:logo) - end - - test "swap with another user" do - assert_changes "bubbles(:logo).assigned_to?(users(:david))", from: false, to: true do - assert_changes "bubbles(:logo).assigned_to?(users(:kevin))", from: true, to: false do - post bucket_bubble_assignment_swaps_url(buckets(:writebook), bubbles(:logo)), params: { - incoming_assignee_id: users(:david).id, - outgoing_assignee_id: users(:kevin).id - } - end - end - assert_redirected_to bubbles(:logo) - end - - test "swap with another user when already assigned" do - assert_no_changes "bubbles(:logo).assigned_to?(users(:jz))" do - assert_changes "bubbles(:logo).assigned_to?(users(:kevin))", from: true, to: false do - post bucket_bubble_assignment_swaps_url(buckets(:writebook), bubbles(:logo)), params: { - incoming_assignee_id: users(:jz).id, - outgoing_assignee_id: users(:kevin).id - } - end - end - assert_redirected_to bubbles(:logo) - end -end diff --git a/test/controllers/taggings/swaps_controller_test.rb b/test/controllers/taggings/swaps_controller_test.rb deleted file mode 100644 index 0ebcee208..000000000 --- a/test/controllers/taggings/swaps_controller_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -require "test_helper" - -class Taggings::SwapsControllerTest < ActionDispatch::IntegrationTest - setup do - sign_in_as :kevin - end - - test "swap with same tag" do - assert_changes "bubbles(:logo).tagged_with?(tags(:web))", from: true, to: false do - post bucket_bubble_tagging_swaps_url(buckets(:writebook), bubbles(:logo)), params: { - incoming_tag_id: tags(:web).id, - outgoing_tag_id: tags(:web).id - } - end - assert_redirected_to bubbles(:logo) - end - - test "swap with another tag" do - assert_changes "bubbles(:logo).tagged_with?(tags(:mobile))", from: false, to: true do - assert_changes "bubbles(:logo).tagged_with?(tags(:web))", from: true, to: false do - post bucket_bubble_tagging_swaps_url(buckets(:writebook), bubbles(:logo)), params: { - incoming_tag_id: tags(:mobile).id, - outgoing_tag_id: tags(:web).id - } - end - end - assert_redirected_to bubbles(:logo) - end - - test "swap with another tag when already tagged" do - assert_no_changes "bubbles(:layout).tagged_with?(tags(:mobile))" do - assert_changes "bubbles(:layout).tagged_with?(tags(:web))", from: true, to: false do - post bucket_bubble_tagging_swaps_url(buckets(:writebook), bubbles(:layout)), params: { - incoming_tag_id: tags(:mobile).id, - outgoing_tag_id: tags(:web).id - } - end - end - assert_redirected_to bubbles(:layout) - end -end