From 4fed58182908b9c71ba420191253b413f747c45c Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 10 Mar 2012 20:51:37 +0000 Subject: [PATCH] Remove the notes feature --- SparkleLib/Git/SparkleRepoGit.cs | 11 +-- SparkleLib/SparkleRepoBase.cs | 108 +--------------------- SparkleShare/SparkleControllerBase.cs | 20 ---- SparkleShare/SparkleEventLogController.cs | 16 ---- data/html/event-entry.html | 10 -- data/html/event-log.html | 101 -------------------- 6 files changed, 6 insertions(+), 260 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 529503e8..53a3dae4 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -658,7 +658,7 @@ namespace SparkleLib.Git { file_path = file_path.Substring (0, file_path.Length - ".empty".Length); - if (change_type.Equals ("A") && !file_path.Contains (".notes")) { + if (change_type.Equals ("A")) { change_set.Added.Add (file_path); } else if (change_type.Equals ("M")) { @@ -692,7 +692,6 @@ namespace SparkleLib.Git { change_set.Deleted.Count + change_set.MovedFrom.Count) > 0) { - change_set.Notes.AddRange (GetNotes (change_set.Revision)); change_sets.Add (change_set); } } @@ -722,9 +721,6 @@ namespace SparkleLib.Git { continue; - } else if (child_path.EndsWith (".notes")) { - continue; - } else if (child_path.EndsWith (".git")) { continue; } @@ -784,10 +780,7 @@ namespace SparkleLib.Git { if (file_name.EndsWith (".empty")) file_name = file_name.Substring (0, file_name.Length - 6); - if (file_name.StartsWith (".notes")) - message += "added a note"; - else - message += "+ ‘" + file_name + "’" + n; + message += "+ ‘" + file_name + "’" + n; count++; if (count == max_count) diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 5c862d54..a2ced8f7 100755 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -64,9 +64,6 @@ namespace SparkleLib { public delegate void NewChangeSetEventHandler (SparkleChangeSet change_set); public event NewChangeSetEventHandler NewChangeSet; - public delegate void NewNoteEventHandler (SparkleUser user); - public event NewNoteEventHandler NewNote; - public delegate void ConflictResolvedEventHandler (); public event ConflictResolvedEventHandler ConflictResolved; @@ -259,82 +256,6 @@ namespace SparkleLib { } - public List GetNotes (string revision) { - List notes = new List (); - - string notes_path = Path.Combine (LocalPath, ".notes"); - - if (!Directory.Exists (notes_path)) { - Directory.CreateDirectory (notes_path); - File.SetAttributes (notes_path, FileAttributes.Directory | FileAttributes.Hidden); - } - - Regex regex_notes = new Regex (@"(.+).*" + - "(.+).*" + - "([0-9]+).*" + - "(.+)", RegexOptions.Compiled); - - foreach (string file_path in Directory.GetFiles (notes_path)) { - if (Path.GetFileName (file_path).StartsWith (revision)) { - string note_xml = String.Join ("", File.ReadAllLines (file_path)); - - Match match_notes = regex_notes.Match (note_xml); - - if (match_notes.Success) { - SparkleNote note = new SparkleNote () { - User = new SparkleUser (match_notes.Groups [1].Value, - match_notes.Groups [2].Value), - Timestamp = new DateTime (1970, 1, 1).AddSeconds (int.Parse (match_notes.Groups [3].Value)), - Body = match_notes.Groups [4].Value - }; - - notes.Add (note); - } - } - } - - return notes; - } - - - public void AddNote (string revision, string note) - { - string notes_path = Path.Combine (LocalPath, ".notes"); - - if (!Directory.Exists (notes_path)) - Directory.CreateDirectory (notes_path); - - // Add a timestamp in seconds since unix epoch - int timestamp = (int) (DateTime.UtcNow - new DateTime (1970, 1, 1)).TotalSeconds; - - string n = Environment.NewLine; - note = "" + n + - " " + n + - " " + SparkleConfig.DefaultConfig.User.Name + "" + n + - " " + SparkleConfig.DefaultConfig.User.Email + "" + n + - " " + n + - " " + timestamp + "" + n + - " " + note + "" + n + - "" + n; - - string note_name = revision + SHA1 (timestamp.ToString () + note); - string note_path = Path.Combine (notes_path, note_name); - - StreamWriter writer = new StreamWriter (note_path); - writer.Write (note); - writer.Close (); - - - // The watcher doesn't like .*/ so we need to trigger - // a change manually - FileSystemEventArgs args = new FileSystemEventArgs (WatcherChangeTypes.Changed, - notes_path, note_name); - - OnFileActivity (args); - SparkleHelpers.DebugInfo ("Note", "Added note to " + revision); - } - - private void SyncUpBase () { try { @@ -411,23 +332,8 @@ namespace SparkleLib { List change_sets = GetChangeSets (1); if (change_sets != null && change_sets.Count > 0) { - SparkleChangeSet change_set = change_sets [0]; - - bool note_added = false; - foreach (string added in change_set.Added) { - if (added.Contains (".notes")) { - if (NewNote != null) - NewNote (change_set.User); - - note_added = true; - break; - } - } - - if (!note_added) { - if (NewChangeSet != null) - NewChangeSet (change_set); - } + if (NewChangeSet != null) + NewChangeSet (change_sets [0]); } } @@ -452,14 +358,8 @@ namespace SparkleLib { EnableWatching (); this.progress_percentage = 0.0; - this.progress_speed = ""; - - string notes_path = Path.Combine (LocalPath, ".notes"); - - if (Directory.Exists (notes_path)) - File.SetAttributes (notes_path, - FileAttributes.Directory | FileAttributes.Hidden); - } + this.progress_speed = ""; + } private void CreateWatcher () diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 11a76ed7..d924ad74 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -629,12 +629,6 @@ namespace SparkleShare { NotificationRaised (change_set); }; - repo.NewNote += delegate (SparkleUser user) { - if (NoteNotificationRaised != null) - NoteNotificationRaised (user, repo.Name); - - }; - repo.ConflictResolved += delegate { if (AlertNotificationRaised != null) AlertNotificationRaised ("Conflict detected.", @@ -1141,20 +1135,6 @@ namespace SparkleShare { } - public void AddNoteToFolder (string folder_name, string revision, string note) - { - folder_name = folder_name.Replace ("%20", " "); - note = note.Replace ("%20", " "); - - lock (this.repo_lock) { - foreach (SparkleRepoBase repo in Repositories) { - if (repo.Name.Equals (folder_name)) - repo.AddNote (revision, note); - } - } - } - - private string [] tango_palette = new string [] {"#eaab00", "#e37222", "#3892ab", "#33c2cb", "#19b271", "#9eab05", "#8599a8", "#9ca696", "#b88454", "#cc0033", "#8f6678", "#8c6cd0", "#796cbf", "#4060af", diff --git a/SparkleShare/SparkleEventLogController.cs b/SparkleShare/SparkleEventLogController.cs index f8a7b177..a9ddd98b 100755 --- a/SparkleShare/SparkleEventLogController.cs +++ b/SparkleShare/SparkleEventLogController.cs @@ -202,22 +202,6 @@ namespace SparkleShare { url.Substring (1, 1).Equals (":")) { Program.Controller.OpenFile (url); - - } else { - Regex regex = new Regex (@"(.+)~(.+)~(.+)"); - Match match = regex.Match (url); - - if (match.Success) { - string folder_name = match.Groups [1].Value; - string revision = match.Groups [2].Value; - string note = match.Groups [3].Value; - - Thread thread = new Thread (new ThreadStart (delegate { - Program.Controller.AddNoteToFolder (folder_name, revision, note); - })); - - thread.Start (); - } } } } diff --git a/data/html/event-entry.html b/data/html/event-entry.html index e5189fb2..287cd2db 100755 --- a/data/html/event-entry.html +++ b/data/html/event-entry.html @@ -6,17 +6,7 @@
-
Add note
Show all
- -
- - - -
-
-
diff --git a/data/html/event-log.html b/data/html/event-log.html index 7c5927e5..8974fa37 100755 --- a/data/html/event-log.html +++ b/data/html/event-log.html @@ -28,24 +28,12 @@ } }, 60 * 1000); - - $('.comments-section').each (function () { - if ($(this).find ('.comments').children ().size () < 1) { - $(this).hide (); - } - }); - $('.buddy-icon').each (function () { if ($(this).css('backgroundImage').indexOf ('@') != -1) { $(this).css ('backgroundColor', '#fff'); } }); - // Show the form when 'Add note' is clicked - $('.note').click(function () { - $(this).parent ().find ('.comments-section').show (); - }); - // Hide the 'Show all' link when there are less than 10 events $('.show').each (function () { var entries = $(this).parent ().find ('dl').children ().length; @@ -63,33 +51,6 @@ $(this).parent ().find ('dl').children ().show (); $(this).hide (); }); - - $("input").click(function () { - textarea = $(this).parent ().find ('textarea'); - text = textarea.val (); - - if (text == '') - return; - - // Clear the textarea - textarea.val (''); - - table = $(this).parent ().find (".comments"); - comments = table.html (); - - // Add the note to the html - comments += '
' + - '

' + - '

' + - text + - '
'; - - table.html (comments); - - // Feed the note to the backend - location = this.id + '~' + text; - }); }); @@ -118,13 +79,6 @@ color: ; } - .comment-text { - font-size: 90%; - padding: 12px; - background-color: #FFF4DB; - margin-bottom: 2px; - } - .day-entry-header { color: #aaa; margin-left: auto; @@ -183,7 +137,6 @@ float: right; } - .event-entry { margin-bottom: 24px; padding-bottom: 24px; @@ -288,60 +241,6 @@ width: 48px; height: 48px; } - - .comments { - width: 100%; - font-size: 90%; - margin-bottom: 9px; - } - - .comment-author { - font-size: 90%; - font-weight: bold; - margin: 0; - margin-bottom: 9px; - background-repeat: no-repeat; - background-position: bottom left; - background-size: 24px; - height: 24px; - padding-left: 30px; - line-height: 24px; - } - - .comment-timestamp { - color: ; - text-align: right; - } - - .comment-button { - float:right; - margin-top: 6px; - } - - .comment-textarea { - box-sizing: border-box; - -webkit-box-sizing: border-box; - width: 100%; - height: 3em; - padding-bottom: 6px; - } - - .comments-section { - box-sizing: border-box; - -webkit-box-sizing: border-box; - width: 100%; - } - - .comments-wrapper { - box-sizing: border-box; - -webkit-box-sizing: border-box; - width: 100%; - margin-top: 12px; - } - - .comment-text { - padding-bottom: 15px; - }