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

Add optional display name suffix #433

Closed
wants to merge 1 commit into from
Closed

Conversation

dalcde
Copy link

@dalcde dalcde commented Jul 17, 2020

This allows us to distinguish between Slack users and Matrix users. This
is especially useful when using Matrix as a bridging hub.

Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

Looks very good, just a few things before I can sign off 👍

src/BridgedRoom.ts Show resolved Hide resolved
@@ -87,7 +88,7 @@ export class SlackGhost {
};
}

public async update(message: {user_id?: string, user?: string}, room: BridgedRoom) {
public async update(message: {user_id?: string, user?: string}, room: BridgedRoom, config: IConfig) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend passing in the config in the constructor, and storing the suffix in a property rather than passing it into the update method.

Copy link
Author

Choose a reason for hiding this comment

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

That was my original strategy but it became messy when I had to incorporate the tests. I could try doing it again though

Copy link
Contributor

Choose a reason for hiding this comment

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

In my opinion it's a good thing to not have the config on the SlackGhost as long as only update uses it.

Copy link
Contributor

@Half-Shot Half-Shot Jul 22, 2020

Choose a reason for hiding this comment

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

Would still be nice to pass the suffix into the constructor then rather than the update method, imo. Alternatively if easier, pass the suffix into the update method. I'm not so keen on passing the whole config.

this.displayname = slackUser.profile.display_name;
changed = true;
if (slackUser.profile.display_name) {
const newDisplayname = slackUser.profile.display_name + config.display_name_suffix
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally please use template syntax

Suggested change
const newDisplayname = slackUser.profile.display_name + config.display_name_suffix
const newDisplayname = `${slackUser.profile.display_name}${config.display_name_suffix}`

Copy link
Contributor

@jaller94 jaller94 Jul 22, 2020

Choose a reason for hiding this comment

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

@Half-Shot If we want to enforce this style, we should change the tslint.json.
Our current config:

    "prefer-template": [
      true,
      "allow-single-concat"
    ],

It's auto-fixable.
https://eslint.org/docs/rules/prefer-template

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, let's do that in another PR!

config/config.sample.yaml Show resolved Hide resolved
This allows us to distinguish between Slack users and Matrix users. This
is especially useful when using Matrix as a bridging hub.

Signed-off-by: Dexter Chua <dec41@srcf.net>
@dalcde
Copy link
Author

dalcde commented Jul 22, 2020 via email

@jaller94
Copy link
Contributor

Yep, I mistook display name for username (commonly called "localpart" in Synapse). My bad.

@Half-Shot
Copy link
Contributor

@dalcde Hiya, sorry this has been left to rot for two years. How would you feel about rebasing and finish off the changes?

@dalcde
Copy link
Author

dalcde commented Jul 29, 2022 via email

@Half-Shot Half-Shot closed this Aug 9, 2022
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.

None yet

3 participants