On Jul 16, 2015, at 2:19 AM, Jonas Schmid <jonas....@gmail.com> wrote:I have problems with the sync function with deleted documents. When I delete a document, the other users do not see it as deleted. They do not receive the update.
On Jul 16, 2015, at 6:08 AM, Jonas Schmid <jonas....@gmail.com> wrote:I now understand. Since the document is deleted, the access rights it has given are revoked and the users do not have access to the channel.How would you update my structure so that users are notified that the chatroom has been removed?
We see that each channel has one yellow document, the "chatroom" document, and two regular "messages" documents.
The user1 has access to both channels. user4 also has access to them.
Now I will delete a chatroom from my mobile UI. This effectively deletes the "chatroom" document.
We see now that there are still two channels (we kept the "messages" documents from the deleted chatroom), but one chatroom document is gone, as expected.
But now is the problem. It appears that the user1 does not have access to the channel!
Since he does not have access to the channel, he will not receive the "deleted" revision, right?
I guess he must receive the "_removed" document, but that's not the case.
Do I understand something wrong?
Many thanks,
Jonas
"user1": {
"password": "user1",
"admin_channels": ["users","user1-rooms"]
},
```
curl -X GET http://user1:user1@localhost:4984/couchbase-chat/_changes?feed=continuous
Then add a chatroom:
curl -X PUT http://user1:user1@localhost:4984/couchbase-chat/testchannel1 -d '{"members": ["user2","user1","user4"],"name": "still","type": "chatroom","user": "user1"}' -H "Content-Type: application/json"
response:
{"id":"testchannel1","ok":true,"rev":"1-9bda027ae976eaec039a180fd16f3a8d"}
Then delete the chat room:
curl -X PUT http://user1:user1@localhost:4984/couchbase-chat/testchannel1 -d '{"_rev":"1-9bda027ae976eaec039a180fd16f3a8d","_deleted":true}' -H "Content-Type: application/json"
response:
{"id":"testchannel1","ok":true,"rev":"2-e5851b5cb894cb7ff2badf951e21b3f5"}
I see both revisions now on the _changes feed:
{"seq":2,"id":"_user/user1","changes":[]}
{"seq":7,"id":"testchannel1","changes":[{"rev":"1-9bda027ae976eaec039a180fd16f3a8d"}]}
{"seq":8,"id":"testchannel1","deleted":true,"removed":["user1-rooms"],"changes":[{"rev":"2-e5851b5cb894cb7ff2badf951e21b3f5"}]}