Permalink
Browse files

Do not rename SortMyBox folders.

  • Loading branch information...
mustpax committed Sep 8, 2012
1 parent 15da9ae commit b6e9ffdde38e99d564c91e0a94116840fd77ea76
Showing with 5 additions and 38 deletions.
  1. +2 −25 app/controllers/Application.java
  2. +0 −12 app/views/Application/index.html
  3. +3 −1 test/unit/models/UserTest.java
@@ -78,29 +78,11 @@ public static void dirs(String path) {
}
}
- /**
- * @param user the logged in user
- * @return InitResult the result of initialization
- */
private static InitResult initSortbox(User user) {
boolean createdSortboxDir = false;
boolean createdCannedRules = false;
- boolean updatedSortingFolder = false;
try {
ApiClient client = ApiClientFactory.create(user);
- // re-branding requires us to change the sorting folder name
- if (Dropbox.getOldSortboxPath().equals(user.sortingFolder)) {
- if (client.exists(user.sortingFolder)) {
- Logger.info("User with old Sortbox folder path logged in, moving old folder to new location");
- client.move(Dropbox.getOldSortboxPath(),
- Dropbox.getSortboxPath());
- }
-
- Logger.info("User with old Sortbox folder path logged in, updating sortingFolder in datastore");
- user.sortingFolder = Dropbox.getSortboxPath();
- user.save();
- updatedSortingFolder = true;
- }
// now get the new sorting folder path for the user and keep going forward
String sortboxPath = user.sortingFolder;
@@ -117,10 +99,8 @@ private static InitResult initSortbox(User user) {
} catch (InvalidTokenException e) {
Logger.error(e, "Invalid OAuth token for user %s", user);
Login.logout();
- } catch (FileMoveCollisionException e) {
- Logger.warn("SortMyBox folder already exists for user '%s'", user);
}
- return new InitResult(createdSortboxDir, createdCannedRules, updatedSortingFolder);
+ return new InitResult(createdSortboxDir, createdCannedRules);
}
/**
@@ -149,12 +129,9 @@ private static boolean createCannedRules(final User user) {
/** whether the app populated canned rules */
final public boolean createdCannedRules;
- final public boolean updatedSortingFolder;
-
- InitResult(boolean createdSortboxDir, boolean createdCannedRules,boolean updatedSortingFolder) {
+ InitResult(boolean createdSortboxDir, boolean createdCannedRules) {
this.createdSortboxDir = createdSortboxDir;
this.createdCannedRules = createdCannedRules;
- this.updatedSortingFolder = updatedSortingFolder;
}
}
}
@@ -26,18 +26,6 @@ <h4 class="alert-heading">SortMyBox created!</h4>
</script>
#{/if}
-#{if initResult.updatedSortingFolder }
-<div class="row">
- <div class="span12">
- <div class="alert alert-info alert-created hide">
- <a class="close" data-dismiss="alert">×</a>
- <h4 class="alert-heading">Your Sortbox folder was renamed to SortMyBox</h4>
- Add your files to the <strong>SortMyBox</strong> folder to get them sorted!
- </div>
- </div>
-</div>
-#{/if}
-
<div class="row">
<div class="span12">
<div class="page-header">
@@ -140,7 +140,9 @@ public void testSortingFolderUpdate() {
//now lets get the user from the DB
User newUser = User.findById(AccountType.DROPBOX, ID);
//verify that the sortingFolder is set to the old value - /Sortbox
- assertEquals("Did not find expected sortingFolder for old users!",Dropbox.getOldSortboxPath(),newUser.sortingFolder);
+ assertEquals("Did not find expected sortingFolder for old users!",
+ Dropbox.getOldSortboxPath(),
+ newUser.sortingFolder);
}
@Test

0 comments on commit b6e9ffd

Please sign in to comment.