[deploy] Bug Fix:Redirect to Direct User Channel for Org Listings (#9616)
This commit is contained in:
parent
c2aa775d12
commit
94251c2f30
3 changed files with 16 additions and 6 deletions
|
|
@ -7,7 +7,8 @@ class ListingsController < ApplicationController
|
|||
title processed_html tag_list category id user_id slug contact_via_connect location
|
||||
],
|
||||
include: {
|
||||
author: { only: %i[username name], methods: %i[username profile_image_90] }
|
||||
author: { only: %i[username name], methods: %i[username profile_image_90] },
|
||||
user: { only: %i[username], methods: %i[username] }
|
||||
}
|
||||
}.freeze
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,14 @@ const firstListing = {
|
|||
tags: ['go', 'git'],
|
||||
user_id: 1,
|
||||
author: {
|
||||
name: 'Mrs. Yoko Christiansen',
|
||||
username: 'mrschristiansenyoko',
|
||||
name: 'Evil Corp Org',
|
||||
username: 'evil_corp_org',
|
||||
profile_image_90:
|
||||
'/uploads/user/profile_image/7/4b1c980a-beb0-4a5f-b3f2-acc91adc503c.png',
|
||||
},
|
||||
user: {
|
||||
username: 'mrschristiansenyoko',
|
||||
},
|
||||
};
|
||||
|
||||
const secondListing = {
|
||||
|
|
@ -37,6 +40,9 @@ const secondListing = {
|
|||
profile_image_90:
|
||||
'/uploads/user/profile_image/7/4b1c980a-beb0-4a5f-b3f2-acc91adc503c.png',
|
||||
},
|
||||
user: {
|
||||
username: 'fred',
|
||||
},
|
||||
};
|
||||
|
||||
const thirdListing = {
|
||||
|
|
@ -55,6 +61,9 @@ const thirdListing = {
|
|||
profile_image_90:
|
||||
'/uploads/user/profile_image/7/4b1c980a-beb0-4a5f-b3f2-acc91adc503c.png',
|
||||
},
|
||||
user: {
|
||||
username: 'mrsjohnmack',
|
||||
},
|
||||
};
|
||||
|
||||
const listings = [firstListing, secondListing, thirdListing];
|
||||
|
|
@ -121,11 +130,11 @@ describe('<AllListings />', () => {
|
|||
expect(gitTag.getAttribute('href')).toEqual('/listings?t=git');
|
||||
|
||||
// listing author
|
||||
const listing1Author = getByText('Mrs. Yoko Christiansen', {
|
||||
const listing1Author = getByText('Evil Corp Org', {
|
||||
selector: '[data-testid="single-listing-20"] a',
|
||||
});
|
||||
|
||||
expect(listing1Author.getAttribute('href')).toEqual('/mrschristiansenyoko');
|
||||
expect(listing1Author.getAttribute('href')).toEqual('/evil_corp_org');
|
||||
|
||||
// 2nd listing
|
||||
getByTestId('single-listing-21');
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ export class Listings extends Component {
|
|||
formData.append('message', `**re: ${openedListing.title}** ${message}`);
|
||||
formData.append('controller', 'chat_channels');
|
||||
|
||||
const destination = `/connect/@${openedListing.author.username}`;
|
||||
const destination = `/connect/@${openedListing.user.username}`;
|
||||
const metaTag = document.querySelector("meta[name='csrf-token']");
|
||||
window
|
||||
.fetch('/chat_channels/create_chat', {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue