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

ChatChannelSettingsSection component: remove hardcoded email #9826

Closed
Rafi993 opened this issue Aug 17, 2020 · 7 comments · Fixed by #10125
Closed

ChatChannelSettingsSection component: remove hardcoded email #9826

Rafi993 opened this issue Aug 17, 2020 · 7 comments · Fixed by #10125
Assignees
Labels
area: generalization New communities and generalization of the codebase bug always open for contribution

Comments

@Rafi993
Copy link
Contributor

Rafi993 commented Aug 17, 2020

Describe the bug

Email yo@dev.to is hardcoded in component app/javascript/chat/ChatChannelSettings/ChatChannelSettingsSection.jsx

Expected behavior

Email should be fetched from the settings

Desktop:

  • OS, version: Ubuntu 20.04
  • Browser, version: Brave Version 1.12.112 Chromium: 84.0.4147.125 (Official Build) (64-bit)
@github-actions
Copy link
Contributor

Thanks for the issue! We'll take your request into consideration and follow up if we decide to tackle this issue.

To our amazing contributors: issues labeled type: bug are always up for grabs, but for feature requests, please wait until we add a ready for dev before starting to work on it.

To claim an issue to work on, please leave a comment. If you've claimed the issue and need help, please ping @forem/oss and we will follow up within 3 business days.

For full info on how to contribute, please check out our contributors guide.

@Rafi993 Rafi993 changed the title Remove hardcoded email id in **app/javascript/chat/ChatChannelSettings/ChatChannelSettingsSection.jsx** Remove hardcoded email id in ChatChannelSettingsSection.jsx component Aug 17, 2020
@rhymes rhymes added area: generalization New communities and generalization of the codebase tech: javascript bug always open for contribution labels Aug 17, 2020
@rhymes rhymes changed the title Remove hardcoded email id in ChatChannelSettingsSection.jsx component ChatChannelSettingsSection component: remove hardcoded email Aug 17, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Aug 29, 2020

Hello there. If this issue is not taken I would like to help.

@rhymes
Copy link
Contributor

rhymes commented Aug 29, 2020

I've assigned you the issue. How do you plan to tackle this?

@Rafi993
Copy link
Contributor Author

Rafi993 commented Aug 29, 2020

Right now email is available via rails helper email_link. These could be exposed to the Javascript side by couple of ways

  1. Expose helpers output as Globals
<script type="javascript">
  window.email = <%= email_link %>
</script>

We could build a Javascript (using some helper) that sets these globals that gets included in the app/views/layouts/application.html.erb

  1. Create a route that exposes config as json like GET /config

@Rafi993
Copy link
Contributor Author

Rafi993 commented Aug 29, 2020

I feel like there could be a better way. any thoughts on this?

@rhymes
Copy link
Contributor

rhymes commented Aug 29, 2020

My thought was to simply add the email somewhere in the DOM of the page where the chat is mounted but not sure if that's the best approach either. I remember we have a way to pass data from Rails to webpack but I don't remember where is that used and I can't find it in the docs.

cc @nickytonline

@nickytonline
Copy link
Contributor

You can create a webpacker pack file that is an erb template. The webpack loader to do this is already in place. See https://github.com/usabilityhub/rails-erb-loader for an example of how to do this.

The pack file can get the value from the Rails side and then pass it in as a prop to a component.

One thing to note is that you will not be able to test this file in jest, which is why making the pack file an erb template makes the most sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: generalization New communities and generalization of the codebase bug always open for contribution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants