@@ -27,7 +27,7 @@ TimeProvider timeProvider
2727{
2828 public async Task < long > Post ( long userId , PostNoteRequest request )
2929 {
30- var fullContent = request . Content ? . Trim ( ) ?? string . Empty ;
30+ var fullContent = request . Content ? . NormalizeNewlines ( ) . Trim ( ) ?? string . Empty ;
3131 if ( string . IsNullOrEmpty ( request . Content ) )
3232 {
3333 throw new ArgumentException ( "Nothing was submitted" ) ;
@@ -74,7 +74,7 @@ await longNoteRepository.InsertAsync(new LongNote
7474 }
7575 catch ( Exception ex )
7676 {
77- logger . LogError ( ex , "Failed to sync new note to service {ServiceType}, note ID: {NoteId}" ,
77+ logger . LogError ( ex , "Failed to sync new note to service {ServiceType}, note ID: {NoteId}" ,
7878 syncNoteService . GetType ( ) . Name , note . Id ) ;
7979 }
8080 } ) ;
@@ -97,7 +97,7 @@ public async Task<bool> Update(long userId, long id, PostNoteRequest request)
9797 }
9898
9999 var newNote = mapper . Map < PostNoteRequest , Note > ( request ) ;
100- var fullContent = request . Content ?? string . Empty ;
100+ var fullContent = ( request . Content ?? string . Empty ) . NormalizeNewlines ( ) ;
101101
102102 // the following is a hack for user shukebeta only
103103 if ( existingNote . UserId == 1 && fullContent . IsHtml ( ) )
@@ -147,7 +147,7 @@ public async Task<bool> Update(long userId, long id, PostNoteRequest request)
147147 }
148148 catch ( Exception ex )
149149 {
150- logger . LogError ( ex , "Failed to sync edit note to service {ServiceType}, note ID: {NoteId}" ,
150+ logger . LogError ( ex , "Failed to sync edit note to service {ServiceType}, note ID: {NoteId}" ,
151151 syncNoteService . GetType ( ) . Name , newNote . Id ) ;
152152 }
153153 } ) ;
@@ -174,15 +174,15 @@ public async Task<PageData<Note>> GetUserNotes(long userId, int pageSize, int pa
174174 return await noteRepository . GetUserNotes ( userId , pageSize , pageNumber , includePrivate ) ;
175175 }
176176
177- public async Task < PageData < Note > > GetPublicNotes ( int pageSize , int pageNumber )
177+ public async Task < PageData < Note > > GetPublicNotes ( int pageSize , int pageNumber , long ? excludeUserId = null )
178178 {
179179 if ( pageNumber > Constants . PublicNotesMaxPage )
180180 {
181181 throw new Exception (
182182 $ "We only provide at most { Constants . PublicNotesMaxPage } page of public notes at the moment") ;
183183 }
184184
185- var notes = await noteRepository . GetPublicNotes ( pageSize , pageNumber ) ;
185+ var notes = await noteRepository . GetPublicNotes ( pageSize , pageNumber , false , excludeUserId ) ;
186186 if ( notes . TotalCount > Constants . PublicNotesMaxPage * pageSize )
187187 {
188188 notes . TotalCount = Constants . PublicNotesMaxPage * pageSize ;
@@ -328,7 +328,7 @@ public async Task<bool> Delete(long userId, long id)
328328 }
329329 catch ( Exception ex )
330330 {
331- logger . LogError ( ex , "Failed to sync delete note to service {ServiceType}, note ID: {NoteId}" ,
331+ logger . LogError ( ex , "Failed to sync delete note to service {ServiceType}, note ID: {NoteId}" ,
332332 syncNoteService . GetType ( ) . Name , note . Id ) ;
333333 }
334334 } ) ;
@@ -377,7 +377,7 @@ public async Task<bool> Undelete(long userId, long id)
377377 }
378378 catch ( Exception ex )
379379 {
380- logger . LogError ( ex , "Failed to sync undelete note to service {ServiceType}, note ID: {NoteId}" ,
380+ logger . LogError ( ex , "Failed to sync undelete note to service {ServiceType}, note ID: {NoteId}" ,
381381 syncNoteService . GetType ( ) . Name , undeletedNote . Id ) ;
382382 }
383383 } ) ;
0 commit comments