diff --git a/store/shortcut.go b/store/shortcut.go index 725632e..167bb11 100644 --- a/store/shortcut.go +++ b/store/shortcut.go @@ -166,6 +166,7 @@ func (s *Store) UpdateShortcut(ctx context.Context, update *UpdateShortcut) (*st } shortcut.RowStatus = convertRowStatusStringToStorepb(rowStatus) shortcut.Visibility = convertVisibilityStringToStorepb(visibility) + shortcut.Tags = filterTags(strings.Split(tags, " ")) var ogMetadata storepb.OpenGraphMetadata if err := protojson.Unmarshal([]byte(openGraphMetadataString), &ogMetadata); err != nil { return nil, err @@ -247,7 +248,7 @@ func (s *Store) ListShortcuts(ctx context.Context, find *FindShortcut) ([]*store } shortcut.RowStatus = convertRowStatusStringToStorepb(rowStatus) shortcut.Visibility = storepb.Visibility(storepb.Visibility_value[visibility]) - shortcut.Tags = strings.Split(tags, " ") + shortcut.Tags = filterTags(strings.Split(tags, " ")) var ogMetadata storepb.OpenGraphMetadata if err := protojson.Unmarshal([]byte(openGraphMetadataString), &ogMetadata); err != nil { return nil, err @@ -315,6 +316,16 @@ func vacuumShortcut(ctx context.Context, tx *sql.Tx) error { return nil } +func filterTags(tags []string) []string { + result := []string{} + for _, tag := range tags { + if tag != "" { + result = append(result, tag) + } + } + return result +} + func convertVisibilityStringToStorepb(visibility string) storepb.Visibility { return storepb.Visibility(storepb.Visibility_value[visibility]) } diff --git a/web/src/components/ShortcutView.tsx b/web/src/components/ShortcutView.tsx index eae9b26..9248fe5 100644 --- a/web/src/components/ShortcutView.tsx +++ b/web/src/components/ShortcutView.tsx @@ -59,26 +59,35 @@ const ShortcutView = (props: Props) => { return ( <> -
+
-
- +
+ {favicon ? ( ) : ( )} -
-
+
-
+
{havePermission && ( { > Edit +
+
+ {shortcut.tags.map((tag) => { + return ( + viewStore.setFilter({ tag: tag })} + > + #{tag} + + ); + })} + {shortcut.tags.length === 0 && No tags} +