-
Notifications
You must be signed in to change notification settings - Fork 187
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
Made URL of new channel creation page more generic #4863
base: unstable
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! I tested it and it works, but I have several requested changes and suggestions
.then(channel => { | ||
if (this.isNew) { | ||
const newChannelId = channel.id; | ||
window.location = window.Urls.channel(newChannelId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this line of code was existing, but ideally it should have used window.location.assign
. Since the behavior of the new channel creation page is changing, I think it might be better to either use window.location.replace
directly, or perhaps replace
the current location with the RouteNames.CHANNEL_EDIT
route using the new channel ID, then assign
to window.Urls.channel(newChannelId)
if (this.isNew) { | ||
const newChannelId = channel.id; | ||
window.location = window.Urls.channel(newChannelId); | ||
this.$store.dispatch('showSnackbarSimple', this.$tr('channelCreated')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the page needs a reload, I don't know that this snackbar is worth it. The display of it must race the page load, which could mean it's never shown, depending on various factors related to speed.
if (!id) { | ||
throw ReferenceError('id must be defined to update a channel'); | ||
throw new ReferenceError('id must be defined to update a channel'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
} | ||
|
||
// Log the data before sending it to create a new channel | ||
console.log('Creating new channel with data:', newChannelData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the console.log
statements in this vuex action. Thank you
|
||
// If there's no channelId (i.e., it's a new channel), skip verifications | ||
if (!channelId) { | ||
//this.isNew = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this commented out code.
// If there's no channelId (i.e., it's a new channel), skip verifications | ||
if (!channelId) { | ||
//this.isNew = true; | ||
this.header = 'New Channel'; // Default header for a new channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems redundant with the code in mounted
. I suggest removing this.
this.header = this.channel.name; // Get channel name when user enters modal | ||
if (this.isNew) { | ||
// For a new channel, set a default header | ||
this.header = 'New Channel'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to use our UI strings. For example, using this.$tr
with the preexisting string key in the $trs
object of the component.
return Channel.createModel(newChannelData).then(response => { | ||
console.log('API Response:', response); | ||
|
||
const createdChannel = response.data || response; // Adjust based on API structure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must be one or the other-- either response.data
or response
? I suggest making this specific.
} | ||
if (contentDefaults !== NOVALUE) { | ||
newChannelData.content_defaults = contentDefaults; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above code is very similar to the if
branch above in this function. I'm requesting deduplication of the code because the only real difference should be the presence of id
which isn't significant enough to warrant the duplication. For example, it seems there are differences here in how it handles the thumbnail above, which leads to a regression that I can see when you upload a thumbnail for a new channel and adjust it's cropping.
hey @bjester ,I’ve implemented the changes you suggested, and everything is working as expected in terms of the channel creation process. However, I’ve encountered another issue. Whenever I close the ChannelModal without creating a new channel or when selecting the "EXIT WITHOUT SAVING" option after editing, an empty channel is still being created which on reloading the empty channel vanishes. I don't know why this is happening ,Could you kindly assist in identifying the root cause of this behavior and help me resolve it? |
@shruti862 was this the case before your latest changes in this pull request? If so, feel free to open a new issue if there is not one yet. If your changes introduce it, it'd be best to spend some time debugging and resolve it in this pull request. |
@MisRob, the empty channel creation issue is due to my recent changes. After debugging, I have identified the root cause and will resolve it soon. |
Hey, @MisRob @bjester , createChannel function was creating an empty channel ::
When I removed the function from the line of code:
Due to this change ,one frontend test is failing which says new channel should be created when new channel button is clicked which should not be the case because clicking on create button in new channel modal should create a new channel. |
Hello @shruti862, we will follow-up with you, however please be patient as we have a large queue of pull request to work through. It's good to send a reminder if we don't reply roughly after a week. Thank you! |
@MisRob ,I apologize if I caused any inconvenience. I appreciate your time and will wait patiently. Thank you! |
No problem @shruti862 at all. Thank you. |
Hi @shruti862
Good news, thanks.
This sounds that you just need to update tests to align them well with your changes, is that right? Basically the test suite would ideally correspond to user experience so you're welcome to update the test accordingly. |
@shruti862 Also if you find any other tests related to this feature that are perhaps still passing but their description or implementation doesn't correspond anymore, that's always great to update too. Thanks for reaching out to clarify this and let us know if you needed anything else. |
Hey @MisRob ,Thank you for clarifying my doubt :). I will soon update the test. |
Summary
Made URL of new channel creation page more generic to avoid 404 channel not found message on refreshing the page
Screencast from 22-12-24 12:22:47 AM IST.webm
References
Fixes issue #2389
Reviewer guidance
…