4188 Validation to prevent kudos-ing your own work

https://code.google.com/p/otwarchive/issues/detail?id=4188

While we don't show the Kudos button on a user's own work, there are other ways to give yourself kudos. Here we add a check that the user leaving kudos is not the user who created the work. (The error message assumes the item is a work, but I used `self.commentable_type.classify.constantize.find_by_id()` so this would theoretically work with other types of commentable items, if we ever add kudos to anything else.)
No, this looks at the user the pseud belongs to, so if you own one of the pseud on the work, you can't kudos it. 

Sent from my iPhone

> On Dec 24, 2014, at 5:26 PM, zz9pzza <notifications@github.com> wrote:
> 
> In app/models/kudo.rb:
> 
> > @@ -27,4 +29,19 @@ def name
> >    def dup?
> >      errors.values.to_s.match /already left kudos/
> >    end
> > +
> > +  def cannot_be_author
> > +    if self.pseud
> > +      commentable = self.commentable_type.classify.constantize.find_by_id(self.commentable_id)
> > +      kudos_giver = User.find_by_id(self.pseud.user_id)
> If I have two pseud's can they give kudos on each others work ?
> 
> —
> Reply to this email directly or view it on GitHub.
>