tinode / chat

Instant messaging platform. Backend in Go. Clients: Swift iOS, Java Android, JS webapp, scriptable command line; chatbots
GNU General Public License v3.0
11.94k stars 1.87k forks source link

Group owner {leave} returns no error #102

Closed jaylevin closed 6 years ago

jaylevin commented 6 years ago

Unable to catch error from {leave} message

Is this a bug report of a feature request?

Your environment

Steps to reproduce

leave := &pbx.ClientLeave {
        Topic: topicID,
        Unsub: unsub,
}

leaveMsg         := &pbx.ClientMsg_Leave { Leave: leave }
clientMessage := &pbx.ClientMsg { Message: leaveMsg }

err := resp.Send(clientMessage)
if err != nil {
    log.Println(err)
}
       log.Println("Error:", err)

Am I missing something here? The serve console logs that there is an error, but doesn't return anything for the error.

Expected behaviour

Error returned from resp.Send(clientMessage) should be the same as the one printed to the tinode server console

replyLeaveUnsub: owner cannot unsubscribe

Actual behaviour

Error is nil

Server-side log

2018/06/07 17:14:37 leave:<topic:"grphIYtXahrzz8" unsub:true > 2018/06/07 17:14:37 failed to unsub replyLeaveUnsub: owner cannot unsubscribe

Client-side log

2018/06/07 17:18:24 Error: <nil>

Any help would be much appreciated. Thanks

or-else commented 6 years ago

If unsub is true in

leave := &pbx.ClientLeave {
        Topic: topicID,
        Unsub: unsub,
}

Then it's not a bug but an expected behaviour. The owner cannot hard-unsubscribe from a group. Either set unsub to false or transfer group ownership to someone else first.

jaylevin commented 6 years ago

Ah, that makes some sense, I was setting unsub=true. Much appreciated!