mautrix / signal

A Matrix-Signal puppeting bridge
GNU Affero General Public License v3.0
499 stars 75 forks source link

`displayname_template` has no effect #442

Closed 3hhh closed 8 months ago

3hhh commented 8 months ago

I set

bridge:
    username_template: "{{ 'signal_{{.}}' }}"
    displayname_template: "{{ '{{.ContactName}} (Signal)' }}"

in mautrix-signal v0.4.99+dev.de8c8d97 (Jan 10 2024, 17:17:36).

However the bot sets the names of my contacts to their profile name without the (Signal) suffix even.

tulir commented 8 months ago

Why are you wrapping the templates in {{}} 🤔

Are you sure you're updating the right config file?

3hhh commented 8 months ago

On 2/6/24 21:59, Tulir Asokan wrote:

Why are you wrapping the templates in {{}} 🤔

Are you sure you're updating the right config file?

I just changed it here: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/8b027efb65e6f0febee39cadf87054ef508934ed/roles/custom/matrix-bridge-mautrix-signal/templates/config.yaml.j2#L104

Since the same setting works just fine for another bot, I guess it's the right place.

shukon commented 8 months ago

~~I have a similar problem with the displayname_template. I use displayname_template: '{{or .ProfileName .PhoneNumber "Unknown user"}} (Signal)', but only a few contacts get the profile name they set themselves, most just get the phone number. It's not no effect though, since the "(Signal)" part is respected for all contacts. There just seems to be a problem with most of the profile names. Is there any sort of resync I have to do, except for logging in after the bridge migration?~~

EDIT: nevermind, my problem is once again the switching between profilename and number as mentioned in https://github.com/mautrix/signal/issues/235 and https://github.com/mautrix/signal/issues/396 ... so this is different and I suggest @3hhh to check whether the generated config matches the expected format (as described in the offtopic-block).

Offtopic: more details on the specific situation with the mentioned ansible-playbook While slightly off-topic, to expand on 3hhh's comment concerning the docker-ansible-playbook: Setting the following in the `vars.yml` of the playbook: ``` matrix_mautrix_signal_configuration_extension_yaml: | bridge: displayname_template: "{{ '{{or .ProfileName .PhoneNumber \"Unknown user\"}} (Signal)' }}" ``` results in the following generated config on the server that is used by the bridge: ``` displayname_template: '{{or .ProfileName .PhoneNumber "Unknown user"}} (Signal)' ``` which you can check (assuming default paths) using: ``` ssh $USER@$SERVER "grep 'displayname_template' /matrix/mautrix-signal/config/config.yaml" ```
3hhh commented 8 months ago

I suggest @3hhh to check whether the generated config matches the expected format (as described in the offtopic-block).

Yes, you're right - the config wasn't correctly generated, not sure exactly why. Anyway after re-running ansible it works now, thanks!

Btw I had to wait for some time for the sync to actually happen.

needo37 commented 8 months ago

I suggest @3hhh to check whether the generated config matches the expected format (as described in the offtopic-block).

Yes, you're right - the config wasn't correctly generated, not sure exactly why. Anyway after re-running ansible it works now, thanks!

Btw I had to wait for some time for the sync to actually happen.

Oh! Because I put in a bad PR to the matrix-ansible-docker repo and the displayname got messed up as we were trying to use %raw and %endraw which doesn't work. Everyone using {{ }} for templates!