Change all kudos displays to use users instead of pseuds

Description

Change all kudos displays to use users instead of pseuds. A non-exhaustive list:

  • Remove has_many :kudos on Pseud.

  • Change has_many :kudos, through: :pseuds to just has_many :kudos on User.

  • Update the list of kudos on a work, either the JS-loaded fragment or the full page, to use user names. Expire the existing cached fragments.

  • Update the kudos mailer to use user names. Since kudos emails don't link to the kudos givers (yet, ), it should be fine if we have a mix of pseuds and users in RedisMailQueue during the transition.

  • Update the Rails uniqueness validator on kudos to use user_id instead of pseud_id.

    • We won't clean up the duplicates in the database just yet, and as before people will still be able to get past this check on a dodgy connection, but it will be harder to leave duplicates from the same user (even when changing default pseuds).

    • When we do add the uniqueness constraint at the database level, we'll have the error handling ready at the application level (people will see "left kudos here \:)" as usual).

  • Update all the specs and cukes in the world.

Remove code that edits pseuds on kudos, since we're removing the Rails association between them. However, we will keep saving default pseud IDs on kudos (and removing them when users are deleted) to make this change safe to revert. We will remove the remaining code before dropping the pseud ID column on kudos.

How to test:
Before this issue goes to staging:

  • Pick someone else's work and:

    • Leave guest kudos on it.

    • Leave logged in kudos; change your default pseud and leave logged in kudos on the same work again.

    • Create a new user, leave logged in kudos, delete the user.

  • Pick one of your own works and save the list of kudos on it.

After this issue goes to staging:

  • On someone else's work: you should see the same count of guest kudos, 2 kudos left by you (showing your username), and you should not see the kudos from the deleted user.

  • On your own work, you should see the same list of kudos, with users instead of pseuds. If a kudo was "A (B)" before, now it will just be "B".

With the issue already on staging, some more tests that don't require preparation:

  • Check that leaving guest or logged in kudos still works.

  • Check that leaving guest or logged in kudos a second time on the same work will get you the "left kudos here \:)" message.

  • Check that you can no longer leave kudos after changing default pseuds.

Environment

None

Assignee

redsummernight

Reporter

redsummernight

Roadmap

Misc

Priority

Medium

Affects versions

Fix versions

Components

BackEnd

Difficulty

Medium

Required Access Level

None

Milestone

Internal 0.9
Configure