kamax-matrix / mxisd

Federated Matrix Identity Server
GNU Affero General Public License v3.0
224 stars 115 forks source link

mxisd invitation e-mail notifications are no more compatible with synapse 0.9x #134

Closed NullIsNot0 closed 5 years ago

NullIsNot0 commented 5 years ago

I have configured mxisd's experimental feature to send e-mail notifications about Synapse (Riot) room invites: https://github.com/kamax-matrix/mxisd/blob/master/docs/features/experimental/application-service.md After upgrading to synapse 0.99.1.1 and mxisd 1.3.1 I noticed that I'm no more getting invitation notifications to email. Downgraded to mxisd 1.2.2, but also got no e-mail notifications, but now I noticed that logs containded DEBUG events which stated "This is not an invite event, skipping":

Log from mxisd 1.2.2:

2019-02-19 05:06:45.701  INFO [nio-8090-exec-7]   i.k.m.c.a.v1.AppServiceController : Received AS transaction 7418
2019-02-19 05:06:45.705  INFO [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : Processing AS Transaction 7418: start
2019-02-19 05:06:45.705 DEBUG [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : 1 event(s) parsed
2019-02-19 05:06:45.706  INFO [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : Processing transaction events: start
2019-02-19 05:06:45.706 DEBUG [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : Event $15505528055cYjzk:example.com: processing start
2019-02-19 05:06:45.706 DEBUG [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : Sender: @myusername:example.com
2019-02-19 05:06:45.706 DEBUG [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : This is not an invite event, skipping
2019-02-19 05:06:45.706  INFO [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : Processing transaction events: end
2019-02-19 05:06:45.706  INFO [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : Processed AS transaction 7418 in 1 ms
2019-02-19 05:06:45.706  INFO [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : Saving transaction details to store
2019-02-19 05:06:45.716 DEBUG [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : Removing CompletedFuture from transaction map
2019-02-19 05:06:45.716  INFO [nio-8090-exec-7]  i.kamax.mxisd.as.AppServiceHandler : Processing AS Transaction 7418: end

The same event's log in 1.3.1 (I don't know how to enable DEBUG logs in 1.3.1. They were enabled by default in 1.2.2):

[XNIO-1 task-5] INFO io.kamax.mxisd.as.AppSvcManager - Processing AS Transaction 7416: start
[XNIO-1 task-5] INFO io.kamax.mxisd.as.AppSvcManager - Processing transaction events: start
[XNIO-1 task-5] INFO io.kamax.mxisd.as.AppSvcManager - Processing transaction events: end
[XNIO-1 task-5] INFO io.kamax.mxisd.as.AppSvcManager - Saving transaction details to store
[XNIO-1 task-5] INFO io.kamax.mxisd.as.AppSvcManager - Processed AS transaction 7416 in 59 ms
[XNIO-1 task-5] INFO io.kamax.mxisd.as.AppSvcManager - Processing AS Transaction 7416: end

And I found this functionality in https://github.com/kamax-matrix/mxisd/blob/master/src/main/java/io/kamax/mxisd/as/AppSvcManager.java

line 163-176:

if (!StringUtils.equals("invite", GsonUtil.getStringOrNull(ev, "membership"))) {
    log.debug("This is not an invite event, skipping");
    return;
}

I think synapse (starting version 0.9x) is sending something slightly different in invite event than text "invite", that's why invites from mxisd do not get sent.

I don't know contents of event data returned from synapse, so can't properly say which project is no more compatible with other. Is it synapse or mxisd which need to change to be compatible again?

maxidorius commented 5 years ago

I'll have a look soon-ish and see where the breakage happened and will fix if I can. Thank you for reporting!

maxidorius commented 5 years ago

@NullIsNot0 Seems like I found the issue. I would like to give you a test build - what do you use to install?

NullIsNot0 commented 5 years ago

I use Docker (https://hub.docker.com/r/kamax/mxisd)

maxidorius commented 5 years ago

Give kamax/mxisd:1.3.1-1-gc636500 a shot please

NullIsNot0 commented 5 years ago

Just tried kamax/mxisd:1.3.1-1-gc636500. It works now - email notifications about invitations are sent. Thanks a lot! One thing though - I get 2 notifications for 1 invite event. My colleague got 3 notifications. I'll investigate what are differences in our account and if needed, open a separate issue. This issue is solved.

maxidorius commented 5 years ago

Thank you for your feedback!