Better handle of synapse SQL connection
- Do not fail if it is not configured - Add missing configuration step
This commit is contained in:
@@ -19,8 +19,17 @@ matrix:
|
|||||||
localpart: 'appservice-mxisd'
|
localpart: 'appservice-mxisd'
|
||||||
token:
|
token:
|
||||||
hs: 'HS_TOKEN_CHANGE_ME'
|
hs: 'HS_TOKEN_CHANGE_ME'
|
||||||
|
|
||||||
|
synapseSql:
|
||||||
|
enabled: false ## Do not use this line if Synapse is used as an Identity Store
|
||||||
|
type: '<DB TYPE>'
|
||||||
|
connection: '<DB CONNECTION URL>'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `synapseSql` section is used to retrieve display names which are not directly accessible in this mode.
|
||||||
|
For details about `type` and `connection`, see the [relevant documentation](../../stores/synapse.md).
|
||||||
|
If you do not configure it, some placeholders will not be available in the notification, like the Room name.
|
||||||
|
|
||||||
You can also change the default template of the notification using the `generic.matrixId` template option.
|
You can also change the default template of the notification using the `generic.matrixId` template option.
|
||||||
See [the Template generator documentation](../../threepids/notification/template-generator.md) for more info.
|
See [the Template generator documentation](../../threepids/notification/template-generator.md) for more info.
|
||||||
|
|
||||||
|
@@ -92,7 +92,12 @@ public class AppServiceHandler {
|
|||||||
log.info("Found an email address to notify about room invitation: {}", tpid.getAddress());
|
log.info("Found an email address to notify about room invitation: {}", tpid.getAddress());
|
||||||
Map<String, String> properties = new HashMap<>();
|
Map<String, String> properties = new HashMap<>();
|
||||||
profiler.getDisplayName(sender).ifPresent(name -> properties.put("sender_display_name", name));
|
profiler.getDisplayName(sender).ifPresent(name -> properties.put("sender_display_name", name));
|
||||||
|
try {
|
||||||
synapse.getRoomName(roomId).ifPresent(name -> properties.put("room_name", name));
|
synapse.getRoomName(roomId).ifPresent(name -> properties.put("room_name", name));
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
log.warn("Unable to fetch room name - Did you provide synapse DB information as documented?");
|
||||||
|
log.warn("Underlying error:", e);
|
||||||
|
}
|
||||||
|
|
||||||
IMatrixIdInvite inv = new MatrixIdInvite(roomId, sender, mxid, tpid.getMedium(), tpid.getAddress(), properties);
|
IMatrixIdInvite inv = new MatrixIdInvite(roomId, sender, mxid, tpid.getMedium(), tpid.getAddress(), properties);
|
||||||
notif.sendForInvite(inv);
|
notif.sendForInvite(inv);
|
||||||
|
Reference in New Issue
Block a user