MCPcopy
hub / github.com/ddworken/hishtory / deleteHistoryEntry

Function deleteHistoryEntry

client/tui/tui.go:819–845  ·  view source on GitHub ↗
(ctx context.Context, entry data.HistoryEntry)

Source from the content-addressed store, hash-verified

817}
818
819func 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
847func configureColorProfile(ctx context.Context) {
848 if hctx.GetConf(ctx).ColorScheme == hctx.GetDefaultColorScheme() {

Callers 1

UpdateMethod · 0.85

Calls 5

GetDbFunction · 0.92
GetConfFunction · 0.92
UserIdFunction · 0.92
SendDeletionRequestFunction · 0.92
ClearSearchCacheFunction · 0.92

Tested by

no test coverage detected