mit-teaching-systems-lab / discourse-edx-lti

Discourse plugin for using Discourse as a discussion forum in EdX courses
http://tsl.mit.edu
MIT License
22 stars 6 forks source link

Fix invalid username from edx: 2 underscores and special symbol at the end #24

Closed zimka closed 6 years ago

zimka commented 6 years ago

Hello! Discourse and edx constraints on username are different, and there are at least two cases when discourse user can't be created from valid edx username.

  1. edx username contains double underscore, e.g. "name__surname"
  2. discourse username ends on underscore, e.g. "namesurname". Case can happen because of 20-symbol cutoff in discourse. This PR fixes mentioned cases, however there could be more, I haven't checked. We have faced these problems several times because at our instance edx usernames are generated from email, and all special symbols are replaced by underscores.
kevinrobinson commented 6 years ago

Hi @zimka, thanks for submitting, this is great! I added in a few more comments over in https://github.com/mit-teaching-systems-lab/discourse-edx-lti/pull/25, does that seem good to you and let's merge?