Closed hdgarrood closed 11 years ago
@ixti on an unrelated note, here's the method in redmine_contacts' ContactsHelper which redmine_tags overrides (causing the above issue):
def tag_color(tag_name)
"##{"%06x" % (tag_name.unpack('H*').first.hex % 0xffffff)}"
# "##{"%06x" % (Digest::MD5.hexdigest(tag_name).hex % 0xffffff)}"
# "##{"%06x" % (tag_name.hash % 0xffffff).to_s}"
end
If you're in contact with the author, I'd be interested to know why he chose unpack
as opposed to md5.
On another unrelated note, should I continue making all changes as pull requests, or are you happy for me to put stuff straight in to master?
This fix does the job! Please merge to ixti master .. SOOON!
@hdgarrood as far as I am concerned, you can work on master... as long as you don't introduce bug ;-)
Btw, unit tests (and Travis CI) would allow us to be more confident about that...
@PowerKiKi i agree. Raised #59
RedmineTags::TagsHelper#tag_color assumes it will be passed a Tag (or, to be more specific, something which responds to :name). Now, if the object does not respond to :name, it simply uses the MD5 hexdigest of the object itself -- meaning that it will work when passed a String.
(yes, this is a little bit of a hack -- but I really can't face solving the underlying problem here, which is detailed in this rather distastefully named blog post.)