SyncServerII / Neebla

Private and Self-Owned Social Media
MIT License
1 stars 2 forks source link

Issues after migration #14

Open crspybits opened 3 years ago

crspybits commented 3 years ago

1) An image with the "Missing" icon-- Seems to be one that Natasha added. I'm going to update her app and sign her in and see if that changes things. ("Louisiana Guys" album)

2) Images that are blank. ("Louisiana Guys" album) I looked at one of these. It's only a comment file. I see no associated image file in the database. I wonder if this was broken in the original db?

See below:

mysql> select * from fileIndex where fileGroupUUID = 'B2A70096-94DA-41F1-B291-735FC54DA892'; +-------------+--------------------------------------+--------+--------------------------------------+------------+---------------------------+---------+-------------+---------------------+---------------------+--------------------+--------------------------------------+--------------------------------------+----------------------+ | fileIndexId | fileUUID | userId | deviceUUID | mimeType | appMetaData | deleted | fileVersion | creationDate | updateDate | appMetaDataVersion | fileGroupUUID | sharingGroupUUID | lastUploadedCheckSum | +-------------+--------------------------------------+--------+--------------------------------------+------------+---------------------------+---------+-------------+---------------------+---------------------+--------------------+--------------------------------------+--------------------------------------+----------------------+ | 382 | AABC7D29-4A01-461E-BD20-5B9CE2688E4D | 1 | 924DEA72-2B89-458C-B512-E02F220F402B | text/plain | {"fileType":"discussion"} | 0 | 0 | 2018-05-20 03:03:42 | 2018-05-20 03:03:42 | 0 | B2A70096-94DA-41F1-B291-735FC54DA892 | DB1DECB5-F2D6-441E-8D6A-4A6AF93216DB | NULL | +-------------+--------------------------------------+--------+--------------------------------------+------------+---------------------------+---------+-------------+---------------------+---------------------+--------------------+--------------------------------------+--------------------------------------+----------------------+

crspybits commented 3 years ago

Another issue has come up-- and a more gnarly one. Discussion file contents encoded the userId of the user making the comment:

    func toDictionary() -> [String: Any]? {
        guard case .text(let string) = kind else {
            return nil
        }

        return [
            DiscussionMessage.messageIdKey: messageId,
            DiscussionMessage.senderIdKey: sender.senderId,
            DiscussionMessage.senderDisplayNameKey: sender.displayName,
            DiscussionMessage.sendDateKey: DiscussionMessage.formatter.string(from: sentDate),
            DiscussionMessage.sendTimezoneKey: sentTimezone,
            DiscussionMessage.messageStringKey: string
        ]
    }

(From DiscussionMessage.swift in the Neebla app code). i.e., this is the sender.senderId.

This dictionary is what gets written into the discussion file as a new comment.

The senderId is used to distinguish "self" from others in the discussion.

In the testing database for beta testing of v2.0.0 Neebla, the SyncServerII userId's for Rod and Dany were different than in the production database:

Screen Shot 2021-05-29 at 9 02 17 AM

I took a number of steps in the migration to deal with this, but unfortunately didn't consider the issue of these user id's embedded into discussion file contents. That's a tricky issue because those files are in the cloud storage of the particular user that uploaded the original media item. A full fledged migration of those user id's would have involved modifying the specific comment files in the cloud storage of the users. And that's not easy-- involving use of the credentials tokens in the database for those users and the native cloud storage API's (Google Drive in this case). All other migrations I did involved the SyncServerII database, not end-user data.

Possible solutions:

1) I could put (hack) a change into the code for comments that would do a userId/senderId mapping for (a) comments in a certain range of date/times, for (b) users with specific user id's. This change would have to go in production app code in Neebla. Because of the way comment files work this would have to be done for each of these comment files each time they were used. From the client-side, I can't easily change the entire file and re-upload it. Comment files use a particular conflict resolution mechanism and don't allow for the entire file to be changed from the client side.

2) I could put together some code that could work from Rod and Dany's side and modify the relevant comment files. Relevant files could be a little tricky to figure out. I'd have to again look for certain ranges of date/times in the contents of the comment files. That code would have to run, say, on Rod and Dany's local computers and upload changes back to Google Drive. I.e., they'd have to be using a Google Drive client-side app on their computer. I'd have to figure out what language/system to use to write the code that could run on their systems too. Perhaps Python? Or Pearl? This also would need to run on my own comment files-- because certainly some of my comment files have their (Rod and Dany's) user id's embedded from our testing db usage in the first 6 months of 2021.

Example current comment file contents-- this was created and modified entirely during the v2 Neebla beta testing period:

{
    "imageTitle": "Christopher Prince",
    "elements": [
        {
            "senderId": "1",
            "senderDisplayName": "Christopher Prince",
            "sendTimezone": "America\/Denver",
            "sendDate": "2021-05-24T22:28:36Z",
            "messageString": "Pussy pile :)",
            "id": "7EF80BE5-AED1-4706-B382-B8E68B590DA3"
        },
        {
            "senderDisplayName": "Rod",
            "senderId": "2",
            "sendTimezone": "America\/New_York",
            "sendDate": "2021-05-24T23:43:50Z",
            "id": "676BABAF-ADCB-4EB8-B02C-E3AA43607442",
            "messageString": "Clean cloths or cat bed?"
        },
        {
            "senderId": "3",
            "senderDisplayName": "Dan Ligas",
            "sendTimezone": "America\/New_York",
            "sendDate": "2021-05-25T00:03:21Z",
            "messageString": "Looks like a clothes dryer that doubles as a resort lounge for pussies",
            "id": "A0C00060-4B86-4EB9-95C5-06B9ABE1A0FB"
        },
        {
            "senderId": "1",
            "senderDisplayName": "Christopher Prince",
            "sendTimezone": "America\/Denver",
            "sendDate": "2021-05-25T01:27:10Z",
            "messageString": "Exactly",
            "id": "C6A2ACD1-7590-464A-B3DB-7BF8A82BBE42"
        }
    ],
    "imageUUID": "63BB8997-6C14-4FB9-A772-BD7E67CF2432"
}

This is what the the comment file would look like after the change indicated in method 2) above:

{
    "imageTitle": "Christopher Prince",
    "elements": [
        {
            "senderId": "1",
            "senderDisplayName": "Christopher Prince",
            "sendTimezone": "America\/Denver",
            "sendDate": "2021-05-24T22:28:36Z",
            "messageString": "Pussy pile :)",
            "id": "7EF80BE5-AED1-4706-B382-B8E68B590DA3"
        },
        {
            "senderDisplayName": "Rod",
            "senderId": "3",
            "sendTimezone": "America\/New_York",
            "sendDate": "2021-05-24T23:43:50Z",
            "id": "676BABAF-ADCB-4EB8-B02C-E3AA43607442",
            "messageString": "Clean cloths or cat bed?"
        },
        {
            "senderId": "4",
            "senderDisplayName": "Dan Ligas",
            "sendTimezone": "America\/New_York",
            "sendDate": "2021-05-25T00:03:21Z",
            "messageString": "Looks like a clothes dryer that doubles as a resort lounge for pussies",
            "id": "A0C00060-4B86-4EB9-95C5-06B9ABE1A0FB"
        },
        {
            "senderId": "1",
            "senderDisplayName": "Christopher Prince",
            "sendTimezone": "America\/Denver",
            "sendDate": "2021-05-25T01:27:10Z",
            "messageString": "Exactly",
            "id": "C6A2ACD1-7590-464A-B3DB-7BF8A82BBE42"
        }
    ],
    "imageUUID": "63BB8997-6C14-4FB9-A772-BD7E67CF2432"
}

Just two lines in that JSON file were changed. Rod's senderId was changed to 3, and Dany's was changed to 4.