Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting Set to Collection ignores spaceId #1575

Open
3 tasks done
deff7 opened this issue Sep 12, 2024 · 2 comments
Open
3 tasks done

Converting Set to Collection ignores spaceId #1575

deff7 opened this issue Sep 12, 2024 · 2 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@deff7
Copy link
Member

deff7 commented Sep 12, 2024

Have you read a contributing guide?

  • I have read CONTRIBUTING.md
  • I have searched the existing issues and didn't find any that were similar
  • I have considered creating a pull request with fixes instead of a bug report and want to proceed

Current Behavior

There is no filter by spaceId in set->collection conversion logic, so we get collection with objects from another space. It's not easy to see in interface because client filters all objects by spaceId, the only way to see this bug is go to Flow view

Expected Behavior

Collection should contain only objects from current space

Steps To Reproduce

Prerequisite: have at least 2 spaces

  1. Create Set by relation Creation date
  2. Convert it to Collection
  3. Open Flow view (Cmd+O in Macos)
  4. See that collection has links to objects in another space

Environment

All environments

Anything else?

Conversion logic is placed inside method:

core/block/editor/converter/layout.go:172

func (c *layoutConverter) fromSetToCollection(st *state.State) error {
	dvBlock := st.Get(template.DataviewBlockId)
	if dvBlock == nil {
		return fmt.Errorf("dataview block is not found")
	}
	details := st.Details()
	setSourceIds := pbtypes.GetStringList(details, bundle.RelationKeySetOf.String())
	spaceId := st.SpaceID()

	c.removeRelationSetOf(st)

	dvBlock.Model().GetDataview().IsCollection = true

	ids, err := c.listIDsFromSet(spaceId, setSourceIds)
	if err != nil {
		return err
	}
	st.UpdateStoreSlice(template.CollectionStoreKey, ids)
	return nil
}

we need to add SpaceId filter to generateFilters method in the same file

@deff7 deff7 added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Sep 12, 2024
@Amrit02102004
Copy link

Can I be assigned this issue I think I can do it

@deff7
Copy link
Member Author

deff7 commented Sep 12, 2024

Sure!

@deff7 deff7 assigned deff7 and Amrit02102004 and unassigned deff7 Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants