Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow templating realname #1374

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

3nprob
Copy link

@3nprob 3nprob commented Jun 8, 2021

Addresses #1095

Copy link
Contributor

@jaller94 jaller94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's an issue with the template validation.

config.schema.yml Outdated Show resolved Hide resolved
@3nprob 3nprob requested a review from jaller94 June 10, 2021 17:00
config.schema.yml Outdated Show resolved Hide resolved
# The format of the realname defined for users, either mxid or reverse-mxid
# The format of the realname defined for users.
# either "mxid", "reverse-mxid", or "template:TEMPLATE", where TEMPLATE must
# contain either of $USERID, $LOCALPART, $DISPLAY, $IRCUSER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is template limited to strictly "$USERID", "$LOCALPART", "$DISPLAY", "$IRCUSER" or can it contain prefix/suffix characters, as the help text isn't clear?

I think on the whole I would make mxid and reverse-mxid available as templating options inline with what you have there already (mxid is essentially $USERID) and then drop the whole template: thing entirely, so the setting looks very similar to nickTemplate in the end.

Copy link
Author

@3nprob 3nprob Jun 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can contain prefixes/suffixes (see the test for example).
Agreed, though; if I did this from scratch that's exactly how I would do it as well.

The reason for doing it this way is to keep backwards compatibility so users who have already configured this will keep having it working as previously. Though naturally this is at the expense of added complexity.

What do you think - keep as is or introduce a breaking change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tend to favour dropping support for legacy options in the config, and adding backwards compatibility (with noisy warnings in the code instead).

if (stringMappings.length) {
log.warn("** The IrcServer.mappings config schema has changed, allowing legacy format for now. **");
log.warn("See https://github.com/matrix-org/matrix-appservice-irc/blob/master/CHANGELOG.md for details");
for (const [channelId, roomIds] of stringMappings) {
config.mappings[channelId] = { roomIds: roomIds }
}
}

At a later point, we can remove the old setting.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable, I'll take a stab at that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did the stabbing go?

@3nprob 3nprob force-pushed the template-realname branch 3 times, most recently from 73387cd to 591fca0 Compare August 18, 2021 09:01
@3nprob
Copy link
Author

3nprob commented Aug 18, 2021

@Half-Shot Sorry for leaving this hanging. I have updated it in line with your feedback, hopefully we can have better engagement this round ;)

Copy link
Contributor

@tadzik tadzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :) Thanks!

@3nprob
Copy link
Author

3nprob commented Apr 5, 2022

@jaller94 concern addressed?

@jaller94 jaller94 linked an issue May 20, 2022 that may be closed by this pull request
@GovanifY
Copy link

GovanifY commented Jul 15, 2022

Hi, is there anything stopping the inclusion of this PR?

The only last open review has been dealt with by adding a warning about using a legacy version of the configuration options, as far as I see, so everything seems good to go.

@Half-Shot Half-Shot requested a review from a team as a code owner June 9, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IRC username and IRC Realname
5 participants