sopython/sopython-site

Adding PM Ring to editor's list returns 502 bad gateway error

Closed this issue · 6 comments

Tried to add PM Ring to editor's list Got a 502 bad gateway error.

Same error occurs for adding to DC group.

User ID is 4014959 for testing.

Hmmm... Curious... The code corresponding to admin/groups/editor/ view itself is not there in the codebase (Its either that or I don't know how to search 😕 )

Can't re-create this locally :(

What appears to be going on is a conflict of primary/foreign key interest in the transcript scraper and users that have allowed the app (those go into se_user) but not previously had any permission assigned.

So, if someone's participated in a GM, then their user ID gets added via the transcript scraper, for the fact that each message gets associated with a user. The admin interface then 502's because it's a primary key violation to add that "user" again etc...

You also can't delete the user (without a CASCADE) as they have associated messages.

Appears a temporary work-around is currently to add a user ID to both the user and user_group tables.

You can find all the users who have SE data loaded but no local account with:

SEUser.query.outerjoin(User, SEUser.id == User.id).filter(User.id == None).all()SEUser.query.outerjoin(User, SEUser.id == User.id).filter(User.id == None).all()

Trying to add any of these to a group will raise the error.

Also fails if such a user tries to log in. Has Morgan mentioned this? He's effected. Need to make sure the solution handles both cases.

Since User is a subclass of SEUser, creating it at the ORM level creates a parent instance as well. Perhaps detect if an SEUser exists before User.get_unique decides to create a new instance, and instead issue an insert statement at the core level.