Skip to content

Commit

Permalink
(staging) Fix subscriptions using user_id (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
ambuznego authored Jun 29, 2021
1 parent 87106b0 commit 7783e90
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/js/components/common/NavDrawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class NavDrawer extends Component {

componentDidMount() {
const { socket, user } = this.props
const user_id = user.sub.slice(6)
const user_id = user.sub.startsWith("auth0") ? user.sub.slice(6) : user.sub;

this.channel = socket.channel("graphql:nav_labels", {})
this.channel.join()
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/common/TopBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TopBar extends Component {

componentDidMount() {
const { socket, user } = this.props
const user_id = user.sub;
const user_id = user.sub.startsWith("auth0") ? user.sub.slice(6) : user.sub;

this.channel = socket.channel("graphql:topbar_orgs", {})
this.channel.join()
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/devices/DeviceIndex.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class DeviceIndex extends Component {
this.importChannel.on(`graphql:device_import_update:${currentOrganizationId}:import_list_updated`, (message) => {
const { page, pageSize } = this.state
this.props.importsQuery.refetch({ page, pageSize })
const user_id = user.sub.slice(6)
const user_id = user.sub.startsWith("auth0") ? user.sub.slice(6) : user.sub;

if (user_id === message.user_id && message.status === 'success') {
this.setState({ importComplete: true })
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/organizations/OrganizationsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OrganizationsTable extends Component {

componentDidMount() {
const { socket, user } = this.props
const user_id = user.sub.slice(6)
const user_id = user.sub.startsWith("auth0") ? user.sub.slice(6) : user.sub;

this.channel = socket.channel("graphql:orgs_index_table", {})
this.channel.join()
Expand Down

0 comments on commit 7783e90

Please sign in to comment.