Skip to content

Can't Delete AND Notify #426

@afriedmanGlacier

Description

@afriedmanGlacier

I can't seem to delete an edge (destination or source) and also receive notification in order to do further processing. I ran into this problem while testing ChatSecure (see ChatSecure/ChatSecure-iOS#865)

The wiki page, (https://github.com/yapstudios/YapDatabase/wiki/Relationships#notify), shows that you can have multiple delete rules that allow deleting and notifying

...nodeDeleteRules:YDB_DeleteDestinationIfSourceDeleted | YDB_NotifyIfDestinationDeleted];

Maybe I am misunderstanding the wiki example? Here's the situation using ChatSecure as the example:

OTRBaseMessage in ChatSecure currently has "YDB_DeleteDestinationIfSourceDeleted | YDB_NotifyIfSourceDeleted" for nodeDeleteRules if there is a media item attached to the message. It deletes the media item (in YapDatabaseRelationshipTransaction) without sending notification.

I also tried changing YDB_NotifyIfSourceDeleted to YDB_NotifyIfDestinationDeleted in case this method was called again as a result of the destination being deleted due to the YDB_DeleteDestinationIfSourceDeleted rule, but that didn't work either.

If we change it to just YDB_NotifyIfSourceDeleted, it will send the notification and call yapDatabaseRelationshipEdgeDeleted in OTRMediaItem, but it doesn't actually delete the destination edge item.

So, I'm thinking the best option seems to me like YapDatabaseRelationshipTransaction should check for the YDB_NotifyIfSourceDeleted inside the condition that looks for YDB_DeleteDestinationIfSourceDeleted, which it currently doesnt, and notify before deleting if needed (same with source).

Is that right? Or am I missing something? The flush method is already huge with all the conditions, but being able to both Notify and Delete should be possible and seems like the intent in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions