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

Solves issue #26749 - UPDATED #27155

Merged
merged 17 commits into from
Feb 23, 2017
Merged

Solves issue #26749 - UPDATED #27155

merged 17 commits into from
Feb 23, 2017

Conversation

noveens
Copy link
Contributor

@noveens noveens commented Feb 14, 2017

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mention-bot
Copy link

@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.

@noveens noveens changed the title 26749 final Solves issue #26749 - UPDATED Feb 14, 2017
@PVince81
Copy link
Contributor

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.

@noveens
Copy link
Contributor Author

noveens commented Feb 15, 2017

@PVince81 ,
Sure I'll update the changes by tonight

@noveens
Copy link
Contributor Author

noveens commented Feb 15, 2017

@PVince81 ,
Updated, please recheck.

@@ -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'});
Copy link
Contributor

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.

'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',
Copy link
Contributor

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.

{
usedSpacePercent: usedSpacePercent,
owner: ownerDisplayName,
owner: ownerDisplayName,
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

@noveens noveens Feb 16, 2017

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.

Copy link
Contributor Author

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:

http://pasteboard.co/z2viGllSc.png

Copy link
Contributor

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)

@noveens
Copy link
Contributor Author

noveens commented Feb 16, 2017

@PVince81 ,
Oh got it now, I found some weird dictionarys while randomly going through the code.

Now I know what it does.
Will include the translate capability.

Sure, will test the changes I made.

@noveens
Copy link
Contributor Author

noveens commented Feb 16, 2017

@bartv2, @jmaciasportela, @PVince81 and @Xenopathic ,

Please review the updates, I think bug's solved now.

@@ -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'});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"meout" ?

Copy link
Contributor Author

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

@noveens
Copy link
Contributor Author

noveens commented Feb 17, 2017

@PVince81 ,

Changes pushed.

@PVince81
Copy link
Contributor

Now run make test-js and fix the test issues one by one.

In most cases you need to replace the stubbed call with show instead of showTemporary.
Let me know if you need guidance there.

@noveens
Copy link
Contributor Author

noveens commented Feb 20, 2017

@PVince81 ,
Thanks for the pointers :P
Updated the test-files now.

@noveens
Copy link
Contributor Author

noveens commented Feb 20, 2017

@PVince81 ,
Jenkins still seems to fail, I have no idea why.
Can you please look into it?

@PVince81
Copy link
Contributor

@noveens this time it's bad luck:

15:09:53 Fire up the mysql docker
15:09:53 docker: Error response from daemon: grpc: the connection is unavailable.

@noveens
Copy link
Contributor Author

noveens commented Feb 20, 2017

@PVince81 ,
anything else required for this issue?

@@ -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'});
Copy link
Contributor

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

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'});
Copy link
Contributor

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'
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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

@noveens
Copy link
Contributor Author

noveens commented Feb 23, 2017

@PVince81 ,
Can this be merged, I think it's fine now.

@PVince81
Copy link
Contributor

Yes, Jenkins is green.

@lock
Copy link

lock bot commented Aug 3, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants