-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Solves issue #26749 - UPDATED #27155
Conversation
@noveens, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bartv2, @jmaciasportela, @PVince81 and @Xenopathic to be potential reviewers. |
Now thinking of it, we probably don't need the timeout at all for error messages. The timeout was there in the past because the user could not close error messages. But now with the button they can. And it's better that they stay until closed to make sure the user saw it. Imagine you start uploading a huge file, go away. Then there is an error. If the error disappears after 7 seconds, you'll never know whether the upload succeeded or not. So let's remove the timeout for all errors that are closeable. Just make a single commit, no need to split into so many small commits, there is no benefit for splitting this way. Thanks. |
@PVince81 , |
@PVince81 , |
apps/files/js/file-upload.js
Outdated
@@ -547,7 +547,7 @@ OC.Uploader.prototype = _.extend({ | |||
}, | |||
|
|||
showUploadCancelMessage: _.debounce(function() { | |||
OC.Notification.showTemporary(t('files', 'Upload cancelled.'), {timeout: 10}); | |||
OC.Notification.show('Upload cancelled.', {type: 'error'}); |
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 leave the timeout for this one. Cancelling an upload is a user action.
I tested this and it feels a bit annoying to have to not only cancel the upload but also close the error.
apps/files/js/filelist.js
Outdated
'Could not rename "{fileName}", it does not exist any more', | ||
{fileName: oldName} | ||
) | ||
OC.Notification.show('Could not rename "{fileName}", it does not exist any more', |
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.
You missed/killed the translation function t()
here and many other places.
Please recheck all locations.
apps/files/js/files.js
Outdated
{ | ||
usedSpacePercent: usedSpacePercent, | ||
owner: ownerDisplayName, | ||
owner: ownerDisplayName, |
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.
duplicate key ? also you removed the translation function
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 couldn't find the meaning of t() function
Can you please tell me what it does.
I'll update the changes by tonight
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.
t('Some message {placeholder}', {placeholder: 'some value to insert'})
=> this will render the message "Some message some value to insert".
The "t" function will translate to another language if you switch to another language in the settings, try it.
It would be good if you could also test the changes you made or at least a few, this way you could see that something is wrong with the code.
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.
@PVince81 ,
when i made these changes, always a " [ object object ] " message pops up
my guess would be that "showTemporary" did something with that array but "show" doesn't.
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 have uploaded a screenshot of the same:
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.
Have a closer look at the parenthesis. Now you mixed up the values in a different way.
The correct way is:
OC.Notifications.show(
t(
'some message maybe with {placeholder}',
{placeholder: 'value for placeholder'}
),
{
type: 'error'
}
);
(placeholder optional, only when applicable)
@PVince81 , Now I know what it does. Sure, will test the changes I made. |
@bartv2, @jmaciasportela, @PVince81 and @Xenopathic , Please review the updates, I think bug's solved now. |
apps/files/js/filelist.js
Outdated
@@ -1569,7 +1569,7 @@ | |||
if (e instanceof DOMException) { | |||
console.error(e); | |||
this.changeDirectory('/'); | |||
OC.Notification.showTemporary(t('files', 'Invalid path')); | |||
OC.Notification.show(t('files', 'Invalid path'), {meout: 7, type: 'error'}); |
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.
"meout" ?
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.
oh sorry, my bad :p
Changes pushed. |
Now run In most cases you need to replace the stubbed call with |
@PVince81 , |
@PVince81 , |
@noveens this time it's bad luck:
|
@PVince81 , |
apps/files/js/filelist.js
Outdated
@@ -2650,7 +2656,7 @@ | |||
*/ | |||
_showPermissionDeniedNotification: function() { | |||
var message = t('core', 'You don’t have permission to upload or create files here'); | |||
OC.Notification.showTemporary(message); | |||
OC.Notification.show(t('files', message), {type: 'error'}); |
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.
message
is already translated, no need to retranslate it here
apps/files/js/file-upload.js
Outdated
self.cancelUploads(); | ||
} else { | ||
// HTTP connection problem or other error | ||
OC.Notification.showTemporary(data.errorThrown, {timeout: 10}); | ||
OC.Notification.show(t('files', data.errorThrown), {type: 'error'}); |
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.
don't translate data.errorThrown
here
{ | ||
isHTML: true | ||
isHTML: true, | ||
type: 'error' |
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.
Not technically an error but more like an information message.
Adding the error type does make it display the cross though.
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 guess we should let this be?
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.
Yes, leave it like it was before for now
@PVince81 , |
Yes, Jenkins is green. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
I replaced all instances of showTemporary with show which has a cross to remove notifications.
Related Issue
#26749
Motivation and Context
Brings a cross to remove pop-up notifications.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: