···893893 await db.SaveChangesAsync();
894894 eventSvc.RaiseNoteUpdated(note);
895895896896- if (!isEdit) return note;
896896+ if (!note.Published || !isEdit) return note;
897897898898- await notificationSvc.GenerateMentionNotificationsAsync(note, mentionedLocalUserIds);
898898+ await notificationSvc.GenerateMentionNotificationsAsync(note, mentionedLocalUserIds);
899899 await notificationSvc.GenerateEditNotificationsAsync(note);
900900901901 if (note.LocalOnly || note.User.IsRemoteUser) return note;
···926926 eventSvc.RaiseNoteDeleted(note);
927927 await db.SaveChangesAsync();
928928 await UpdateNoteCountersAsync(note, false);
929929+930930+ if (!note.Published) return;
929931930932 if (note.User.IsRemoteUser)
931933 {
···15781580 {
15791581 if (note.IsPureRenote)
15801582 throw GracefulException.BadRequest("Cannot like a pure renote");
15831583+15841584+ if (!note.Published)
15851585+ throw GracefulException.BadRequest("This note has not been published yet");
1581158615821587 if (!await db.NoteLikes.AnyAsync(p => p.Note == note && p.User == user))
15831588 {
···1613161816141619 public async Task<bool> UnlikeNoteAsync(Note note, User user)
16151620 {
16211621+ if (!note.Published)
16221622+ throw GracefulException.BadRequest("This note has not been published yet");
16231623+16161624 var like = await db.NoteLikes.Where(p => p.Note == note && p.User == user).FirstOrDefaultAsync();
16171625 if (like == null) return false;
16181626 db.Remove(like);
···1640164816411649 public async Task<Note?> RenoteNoteAsync(Note note, User user, Note.NoteVisibility? visibility = null)
16421650 {
16511651+ if (!note.Published)
16521652+ throw GracefulException.BadRequest("This note has not been published yet");
16531653+16431654 visibility ??= user.UserSettings?.DefaultRenoteVisibility ?? Note.NoteVisibility.Public;
16441655 if (visibility == Note.NoteVisibility.Specified)
16451656 throw GracefulException.BadRequest("Renote visibility must be one of: public, unlisted, private");
···17171728 {
17181729 if (user.IsRemoteUser) throw new Exception("This method is only valid for local users");
1719173017311731+ if (!note.Published)
17321732+ throw GracefulException.BadRequest("This note has not been published yet");
17201733 if (note.IsPureRenote)
17211734 throw GracefulException.BadRequest("Cannot pin a pure renote");
17221735 if (note.User != user)
···17521765 public async Task UnpinNoteAsync(Note note, User user)
17531766 {
17541767 if (user.IsRemoteUser) throw new Exception("This method is only valid for local users");
17681768+ if (!note.Published)
17691769+ throw GracefulException.BadRequest("This note has not been published yet");
1755177017561771 var count = await db.UserNotePins.Where(p => p.Note == note && p.User == user).ExecuteDeleteAsync();
17571772 if (count == 0) return;
···1821183618221837 public async Task<(string name, bool success)> ReactToNoteAsync(Note note, User user, string name)
18231838 {
18391839+ if (!note.Published)
18401840+ throw GracefulException.BadRequest("This note has not been published yet");
18241841 if (note.IsPureRenote)
18251842 throw GracefulException.BadRequest("Cannot react to a pure renote");
18261843···1870188718711888 public async Task<(string name, bool success)> RemoveReactionFromNoteAsync(Note note, User user, string name)
18721889 {
18901890+ if (!note.Published)
18911891+ throw GracefulException.BadRequest("This note has not been published yet");
18921892+18731893 name = await emojiSvc.ResolveEmojiNameAsync(name, user.Host);
1874189418751895 var reaction =