Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Use correct error message when renaming/deleting folder #8008

Merged
merged 6 commits into from
Jul 21, 2014

Conversation

marcelgerber
Copy link
Contributor

This is for #8003.

@@ -40,7 +40,9 @@ define({
"UNSUPPORTED_ENCODING_ERR" : "{APP_NAME} currently only supports UTF-8 encoded text files.",
"FILE_EXISTS_ERR" : "The file or directory already exists.",
"FILE" : "file",
"FILE_TITLE" : "File",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this the key to use?

Copy link
Contributor

Choose a reason for hiding this comment

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

Title Casing some but not all dialogs is probably not the way to do this which is why I've added a UI audit to the trello board. I don't think any of the dialogs in project manager use title case for the titles so I vote for leaving this as-is for now. This change makes the rename case different than the create case but we should merge those two handlers so we maintain consistent messaging. There are a few other errors that are not title-case in project manager. Care to fix them as well in this PR since you're cleaning things up? "Error Loading Project, etc..."

@le717
Copy link
Contributor

le717 commented Jun 3, 2014

Since you are correcting the text before the file path, why not do the same for the "The file or directory already exists" part (FILE_EXISTS_ERR message)?

@@ -1782,16 +1782,22 @@ define(function (require, exports, module) {
_redraw(true);
result.resolve();
} else {
var titleType = isFolder ? Strings.DIRECTORY_TITLE : Strings.FILE_TITLE,
Copy link
Contributor

Choose a reason for hiding this comment

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

You should refactor this to use the errorcallback on line 1661 instead so we have the same error messages at least. We have a much better message in there anyway and the logic is much simpler since the message is more generic.

Copy link
Contributor

Choose a reason for hiding this comment

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

You might just want to refactor the error handler so that it calls a common function for displaying the error and pass in an indicator for the operation so we know which strings to use ( Strings.ERROR_CREATING_FILE_TITLE / Strings.ERROR_CREATING_FILE for the create case and Strings.ERROR_RENAMING_FILE_TITLE / Strings.ERROR_RENAMING_FILE for the rename case. ) but
We should have similar messaging for both rename/create cases.

I wonder do you think it's useful to show the OS error string for the rename but not the create case? We might want to make the error more robust for create if you want to merge in the code that for showing the OS error information for create as well.

@marcelgerber
Copy link
Contributor Author

@le717 Because that's another case. If you already have a folder foo, you can't create a file called foo and vice-versa.
So it doesn't matter whether it's a file or a folder named foo.

@marcelgerber
Copy link
Contributor Author

@JeffryBooher Changes pushed.

message;
path = StringUtils.breakableUrl(path);

if (context === "create") {
Copy link
Contributor

Choose a reason for hiding this comment

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

these should be constants as for JSDoc is concerned

/*
 * @constant
*  @type {string} ERR_CTX_CREATE some description
 */
 var ERR_CTX_CREATE = "create";

@JeffryBooher
Copy link
Contributor

@SAplayer nice job with the refactoring. just need to resolve another issue and fix the merge error

@marcelgerber
Copy link
Contributor Author

@JeffryBooher Everything ready. I hope it's fine now.

if (error === FileSystemError.ALREADY_EXISTS) {
var titleType = isFolder ? Strings.DIRECTORY_NAME : Strings.FILENAME;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you use the _showErrorDialog here and just pass in the Strings.ENTRY_WITH_SAME_NAME_EXISTS for message? The replacement format stuff will just be ignored since the string has no {0}, etc...

@JeffryBooher
Copy link
Contributor

Done with review. Looks good just a few cleanup items to consider.

@marcelgerber
Copy link
Contributor Author

@JeffryBooher Everything done.

title = Strings.ERROR_LOADING_PROJECT;
message = StringUtils.format(Strings.OPEN_DIALOG_ERROR, error);
} else if (errType === ERR_TYPE_INVALID_FILENAME) {
title = StringUtils.format(Strings.INVALID_FILENAME_TITLE, isFolder ? Strings.DIRECTORY_NAME : Strings.FILENAME);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still lowercase "Invalid filename" and "Invalid directory name". It doesn't look like DIRECTORY_NAME / FILENAME strings are used elsewhere so you should be able to modify them but double check that I didn't miss anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, I missed those. Fixed.

@marcelgerber
Copy link
Contributor Author

@JeffryBooher Oh well, all these nits... Changed again.

@JeffryBooher
Copy link
Contributor

@SAplayer i think this was the final one :)

@JeffryBooher
Copy link
Contributor

Looks good! Merging

JeffryBooher added a commit that referenced this pull request Jul 21, 2014
Use correct error message when renaming/deleting folder
@JeffryBooher JeffryBooher merged commit 2ee5a98 into adobe:master Jul 21, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants