Support for tags in code snippet API; tag namespaces; donation total per tag

* code_snippet API call accepts a 'tags' parameter
 * tags get included in the code snippet
 * we protect against Bobby Tables by whitelisting allowed characters in tags
* tags are organized into "namespaces", e.g. the tag "petition:123" is in tag namespace "petition"
 * later we can use this to report e.g. the top raising petitions
* we keep a running total (in redis) of how much has been raised in each tag.  this total is in the organization's preferred currency.
why?

On Wed, Sep 24, 2014 at 12:38 PM, Jacinda Moore <notifications@github.com>
wrote:

> In app/models/tag_namespace.rb:
>
> > +  validates :namespace, presence: true
> > +  validates :organization, presence: true
> > +
> > +  has_many :tags, foreign_key: 'namespace_id'
> > +  belongs_to :organization
> > +
> > +  def self.find_or_create!(organization, name)
> > +    namespace = where(namespace: name, organization: organization).first
> > +    if namespace.nil?
> > +      namespace = TagNamespace.create!(namespace: name, organization: organization)
> > +    end
> > +    namespace
> > +  end
> > +
> > +  def most_raised_key
> > +    "most_raised_tags/#{namespace}"
>
> this will do weird things if two organizations have tags with the same
> namespace
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/controlshift/prague-server/pull/12/files#r17982869>.
>



-- 
--
This is my personal email address. If you are emailing me about
ControlShift, please send a note to nathan@controlshiftlabs.com