RSVP username change bug

Environment

Discourse Version: 2.4.0.beta4

Plugin Commit: adc9d6a2d4639ceadbad72cbba8e3b6891ef5382

Other Plugins
None

Steps to Reproduce

  1. RSVP for an event
  2. Change your username
  3. Open list of users “Going” to an event
  4. An exception will be thrown

Angus’ note:

@fzngagan the issue here is that we’re relying on the user’s username to identify them. We need to only rely on the user id.

Example

  1. I RSVP’d for the linked event with user angus45
  2. I changed the username of angus45 to angus46
  3. If you open the “Going” list now an error will be thrown

Logs

Error: Not Found
Url: https://thepavilion.io/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js
Line: 9
Column: 9188
Window Location: Events Example Topic

2 Likes

@angus, I’m working on this and almost there. I think it’ll be ready by tomorrow.

Here’s the PR for this.

Ok, @angus I’ve fixed the issue you mentioned in the review of this PR.

1 Like

@fzngagan Reviewed :+1: A few more changes before we’re ready.

1 Like

@angus, thanks. I’ll get back once those issue are fixed.

1 Like

@angus ,
Ran into some issues related to saving ids as a json array…will fix in the morning…

Ok, the fixes are done… Please do have a look…

1 Like

Related issues

Note for self: Both of these issues are caused due to multiple simultaneous requests to the server which will be fixed by this PR.

1 Like

@angus I’m facing an issue related to user-selector component used on add-event modal. It returns usernames instead of user ids. So what would be the easiest way to get user_ids there.

I’ve described the issue in more detail on github

@fzngagan hm do we need the user_ids on the client? If we just pass the username down to the server we can easily lookup the user to get the id there before saving.

1 Like

makes sense…The selector also gurantees that the username is recent(correct) so yeah, this would work. Thanks

1 Like

Usernames were being used on two places on the client. I already changed one of the implementations to use user_id but the one in discussion(user-selector) needs a username. So, when I started sending username the rsvp going feature broke.

A simple way to rectify this would be, to use the username on client aleways but save it as a userid on backend which solves the original problem also considering the fact that the client side is more friendly with username. I’m planning to look into it from monday onwards.

1 Like

How’s the final push on this one going?

1 Like

Going well…I’ll ping in a few hours.

I discovered a(probably long standing) bug with PostRevisor while working on this which took me some time to identify and fix.

I just tested on sandbox here. When I enable rsvp and add some users and save, then disable rsvp, it gives out a 500 error.

@angus
Ok got this done finally. Please do have a look.

I also fixed this one.

Moved the branch to the main repo(as discussed) and made a PR

1 Like

Nice :+1: The last step here is to add an rspec test. This is a good candidate for testing.

1 Like

Best wishes everyone :wink:
I’m playing around with a dev environment and i’ve tried the rsvp branch on a backup of a prod discourse with rsvp already in use (activated and empty ‘is going’ list to 31)

  • latest commit of discourse
  • i’m stuck with a migration error, i don’t understand what i’m missing:

== 20191016154136 RsvpMigration: migrating ====================================
RSVP for topic: 208 migrated successfully
RSVP for topic: 272 migrated successfully
RSVP for topic: 267 migrated successfully
RSVP for topic: 340 migrated successfully
RSVP for topic: 207 migrated successfully
rails aborted!

StandardError: An error has occurred, this and all later migrations canceled:
undefined method id' for nil:NilClass /home/benjamin/discourse/plugins/discourse-events/db/migrate/20191016154136_rsvp_migration.rb:12:in block (2 levels) in change’
/home/benjamin/discourse/plugins/discourse-events/db/migrate/20191016154136_rsvp_migration.rb:9:in each' /home/benjamin/discourse/plugins/discourse-events/db/migrate/20191016154136_rsvp_migration.rb:9:in block in change’
/home/benjamin/discourse/plugins/discourse-events/db/migrate/20191016154136_rsvp_migration.rb:4:in change' /home/benjamin/discourse/lib/freedom_patches/schema_migration_details.rb:9:in block in exec_migration’
/home/benjamin/discourse/lib/freedom_patches/schema_migration_details.rb:8:in exec_migration' /home/benjamin/discourse/lib/migration/safe_migrate.rb:29:in migrate’
/home/benjamin/discourse/lib/migration/safe_migrate.rb:52:in migrate' /home/benjamin/discourse/lib/tasks/db.rake:72:in block in ’

1 Like

Thanks for the early feedback. This helps a lot.

1 Like

I checked and the culprit is a topic where a user has changed its pseudo. :roll_eyes:
is there a way to find the last pseudo in some kind of log or maybe it easier to delete the changed pseudo from the rsvp list ?

1 Like