mysociety / pombola

GNU Affero General Public License v3.0
65 stars 41 forks source link

[KE] make a single Disqus thread for each object (e.g. person, place, etc.) #2468

Open mhl opened 6 years ago

mhl commented 6 years ago

There is previous history of this problem here: #421, but the changes discussed there were then backed out by 6f20b37edd7b993010699e8d52f2a2d79232b228 - I don't think this was ever revisited after that.

I think our ultimate goal should be what was originally intended - generate a stable identifier for each object which the disqus thread is chosen from. The relevant disqus documentation is here:

I suggest a plan with multiple stages:

  1. On each page or subpage, start setting this.page.url (in the disqus_config function) to the main page URL for the object. (That includes, say: http://info.mzalendo.com/hansard/person/aaron-cheruiyot/appearances/?page=11 which should set this.page.url to http://info.mzalendo.com/person/aaron-cheruiyot/.)
  2. Build a mapping from all existing Disqus URLs to the new canonical one we're setting as in step 1. (You can download all existing thread URLs - visiting that URL triggers a email being sent to you with a CSV file.)
  3. Upload that mapping to Disqus's URL migration tool https://mzalendo-com.disqus.com/admin/discussions/migrate/
  4. Start setting this.page.identifier in the disqus_config function as well. We'd like to move to using more stable identifiers; it'll be easier to maintain in the longer run. These can be the same as how the code used to generate disqus_identifier previously. Warning: I assume that Disqus will then start associating that ID with the thread as well as the URL, so we can later remove the this.page.url but we'll need to carefully check that. I'd suggest setting this.page.identifier just for one page initially, to check that it's still showing comments, and similarly see that it's still showing comments after removing this.page.url.
mhl commented 6 years ago

I've done steps 1 to 3 - now we have to wait up to 24 hours for the URL migration to take place, apparently. However, step 1 seemed to work fine - now there's a single comment thread for all subpages of a person, which means we can close a historic older bug: #1617

Step 4 appears to be difficult unfortunately - when setting this.page.identifier as well as the URL with this.page.url, it no longer finds the existing comment thread. This is not what Disqus suggested here: https://github.com/mysociety/pombola/issues/421#issuecomment-10750512 - but in email correspondence @evdb mentioned the same thing that I've found - it doesn't work.

I'll email Disqus support to ask / complain about this, since it would still be good to use identifiers rather than URLs for comment threads (since slugs can change), but it's unclear how you can migrate.

mhl commented 5 years ago

I haven't had time to ask Disqus about this (i.e. "How do you actual migrate from using this.page.url to this.page.identifier without losing the comments?") - that would be good to follow up on. Another question is "If you're identifying threads by this.page.identifier, is there any way to merge them?"

Once that's resolved, it would be good to create a ticket for getting core_merge_people to also help you in some way to merge Disqus threads.

mhl commented 5 years ago

A thing to ask Disqus about before that, however, is an example I gave in Slack of a comment that appeared to have been lost in the merge (not quoted here, but search for "my admission to the university" in Slack to find it).