From 10d1f13a1b36a00a54d34f619f9589f2cd9d3f5b Mon Sep 17 00:00:00 2001
From: Katsuya Hidaka <hidakatsuya@gmail.com>
Date: Sat, 22 Feb 2025 20:59:57 +0900
Subject: Changes issue watch button icon to eye image to align icon with
 function and improve visual clarity

---
 app/assets/images/icons.svg            | 9 +++++++++
 app/assets/stylesheets/application.css | 5 -----
 app/helpers/watchers_helper.rb         | 3 ++-
 config/icon_source.yml                 | 4 ++++
 test/helpers/watchers_helper_test.rb   | 8 ++++----
 5 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/app/assets/images/icons.svg b/app/assets/images/icons.svg
index 55925cddd..9034f6802 100644
--- a/app/assets/images/icons.svg
+++ b/app/assets/images/icons.svg
@@ -469,6 +469,11 @@
       <path d="M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/>
       <path d="M8 11v-5a4 4 0 0 1 8 0"/>
     </symbol>
+    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--unwatch">
+      <path d="M10.585 10.587a2 2 0 0 0 2.829 2.828"/>
+      <path d="M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"/>
+      <path d="M3 3l18 18"/>
+    </symbol>
     <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--user">
       <path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0"/>
       <path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"/>
@@ -478,6 +483,10 @@
       <path d="M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0z"/>
       <path d="M12 16h.01"/>
     </symbol>
+    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--watch">
+      <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"/>
+      <path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"/>
+    </symbol>
     <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--wiki-page">
       <path d="M6 4h11a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-11a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1m3 0v18"/>
       <path d="M13 8l2 0"/>
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index a17be1e81..20096a30e 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -1777,11 +1777,6 @@ svg.icon-ok {
   display: none;
 }
 
-.icon-fav svg.icon-svg {
-  fill: #ffc400;
-  stroke: #ffc400;
-}
-
 svg.icon-svg {
   stroke: #169;
   fill: none;
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index 882325c18..6e6366846 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -26,6 +26,7 @@ module WatchersHelper
 
     watched = Watcher.any_watched?(objects, user)
     css = [watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ')
+    icon = watched ? 'unwatch' : 'watch'
     text = watched ? l(:button_unwatch) : l(:button_watch)
     url = watch_path(
       :object_type => objects.first.class.to_s.underscore,
@@ -33,7 +34,7 @@ module WatchersHelper
     )
     method = watched ? 'delete' : 'post'
 
-    link_to sprite_icon('fav', text), url, :remote => true, :method => method, :class => css
+    link_to sprite_icon(icon, text), url, :remote => true, :method => method, :class => css
   end
 
   # Returns the css class used to identify watch links for a given +object+
diff --git a/config/icon_source.yml b/config/icon_source.yml
index 8769a3212..7ff0605e4 100644
--- a/config/icon_source.yml
+++ b/config/icon_source.yml
@@ -209,3 +209,7 @@
   svg: square-rounded-plus
 - name: toggle-minus
   svg: square-rounded-minus
+- name: watch
+  svg: eye
+- name: unwatch
+  svg: eye-off
diff --git a/test/helpers/watchers_helper_test.rb b/test/helpers/watchers_helper_test.rb
index c59e8e25d..6f8dbde21 100644
--- a/test/helpers/watchers_helper_test.rb
+++ b/test/helpers/watchers_helper_test.rb
@@ -26,7 +26,7 @@ class WatchersHelperTest < Redmine::HelperTest
 
   test '#watcher_link with a non-watched object' do
     expected = link_to(
-      sprite_icon("fav", "Watch"),
+      sprite_icon("watch", "Watch"),
       "/watchers/watch?object_id=1&object_type=issue",
       :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
     )
@@ -35,7 +35,7 @@ class WatchersHelperTest < Redmine::HelperTest
 
   test '#watcher_link with a single object array' do
     expected = link_to(
-      sprite_icon("fav", "Watch"),
+      sprite_icon("watch", "Watch"),
       "/watchers/watch?object_id=1&object_type=issue",
       :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
     )
@@ -44,7 +44,7 @@ class WatchersHelperTest < Redmine::HelperTest
 
   test '#watcher_link with a multiple objects array' do
     expected = link_to(
-      sprite_icon("fav", "Watch"),
+      sprite_icon("watch", "Watch"),
       "/watchers/watch?object_id%5B%5D=1&object_id%5B%5D=3&object_type=issue",
       :remote => true, :method => 'post', :class => "issue-bulk-watcher icon icon-fav-off"
     )
@@ -59,7 +59,7 @@ class WatchersHelperTest < Redmine::HelperTest
     Watcher.create!(:watchable => Issue.find(1), :user => User.find(1))
 
     expected = link_to(
-      sprite_icon("fav", "Unwatch"),
+      sprite_icon("unwatch", "Unwatch"),
       "/watchers/watch?object_id=1&object_type=issue",
       :remote => true, :method => 'delete', :class => "issue-1-watcher icon icon-fav"
     )
-- 
2.45.2

