(ctx context.Context, entry data.HistoryEntry)
| 817 | } |
| 818 | |
| 819 | func deleteHistoryEntry(ctx context.Context, entry data.HistoryEntry) error { |
| 820 | db := hctx.GetDb(ctx) |
| 821 | // Delete locally |
| 822 | r := db.Model(&data.HistoryEntry{}).Where("device_id = ? AND end_time = ?", entry.DeviceId, entry.EndTime).Delete(&data.HistoryEntry{}) |
| 823 | if r.Error != nil { |
| 824 | return r.Error |
| 825 | } |
| 826 | |
| 827 | // Delete remotely |
| 828 | config := hctx.GetConf(ctx) |
| 829 | if config.IsOffline { |
| 830 | return nil |
| 831 | } |
| 832 | dr := shared.DeletionRequest{ |
| 833 | UserId: data.UserId(hctx.GetConf(ctx).UserSecret), |
| 834 | SendTime: time.Now(), |
| 835 | } |
| 836 | dr.Messages.Ids = append(dr.Messages.Ids, |
| 837 | shared.MessageIdentifier{DeviceId: entry.DeviceId, EndTime: entry.EndTime, EntryId: entry.EntryId}, |
| 838 | ) |
| 839 | err := lib.SendDeletionRequest(ctx, dr) |
| 840 | if err != nil { |
| 841 | return err |
| 842 | } |
| 843 | |
| 844 | return lib.ClearSearchCache(ctx) |
| 845 | } |
| 846 | |
| 847 | func configureColorProfile(ctx context.Context) { |
| 848 | if hctx.GetConf(ctx).ColorScheme == hctx.GetDefaultColorScheme() { |
no test coverage detected