ixti / redmine_tags

Redmine plugin, that adds issues tagging support
GNU General Public License v3.0
196 stars 119 forks source link

Fix NoMethodErrors with redmine_contacts (#49) #54

Closed hdgarrood closed 11 years ago

hdgarrood commented 11 years ago

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.)

hdgarrood commented 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.

hdgarrood commented 11 years ago

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?

cforce commented 11 years ago

This fix does the job! Please merge to ixti master .. SOOON!

PowerKiKi commented 11 years ago

@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...

hdgarrood commented 11 years ago

@PowerKiKi i agree. Raised #59