baedert / corebird

Native Gtk+ Twitter Client
https://corebird.baedert.org
GNU General Public License v3.0
791 stars 78 forks source link

Starting DM thread causes invalid self-thread in list #764

Closed IBBoard closed 7 years ago

IBBoard commented 7 years ago

In the latest Git Master, if you send the first DM to a recipient then Corebird gets the threading wrong and creates a thread for you (which is then empty).

Steps to recreate:

  1. Find a user you haven't DMed
  2. Start a new thread by sending them a DM from Corebird
  3. Go back to the DM Threads page

Expected result:

  1. DM thread to that user containing your initial DM

Actual result:

  1. DM thread to yourself that claims to contain your initial DM, but actually shows up as empty if you click on it

If you don't have a cooperative friend to test this with, create a test account. After testing once, you'll need to delete the DMs from your account on Twitter and then open the sqlite database and delete all dm_threads rows where the user_id is your ID or their ID, and all of the dm rows where from_id or to_id is their ID.

After logging and debugging the problem, I found that the problem is in DMManager.vala ~L199 - it correctly detects the thread_user_id but then just creates a DMThread object using the sender's ID. When you create the thread by sending the first DM then the sender us you!

IBBoard commented 7 years ago

Diff for additional logging

Example logging for good and bad thread creation - note the difference at DMThreadsModel.vala line 63.

I've got a fix for this, but I don't know whether it is better to do more extensive changes (pull out the right info earlier and change the whole function) or make smaller changes (three lines commented out in my logging diff in the DMThread creation section, which include a couple of ternaries)

Vistaus commented 7 years ago

Isn't https://github.com/baedert/corebird/commit/6e6777e680fc9ec93263496839183a328ec0ea3c supposed to fix that?

IBBoard commented 7 years ago

Don't think so - that's about duplicates with self-replies. This is about starting new threads and using the wrong details to create the thread.