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

GO-4168 Rollback SetSource #1629

Merged
merged 10 commits into from
Oct 4, 2024
Merged

GO-4168 Rollback SetSource #1629

merged 10 commits into from
Oct 4, 2024

Conversation

KirillSto
Copy link
Member

@KirillSto KirillSto commented Oct 2, 2024

https://linear.app/anytype/issue/GO-4168/the-selected-query-is-not-deleted-in-the-set-when-clicking-on-the

  • We should rollback previous behaviour of ObjectSetSource, because BlockDataviewSetSource does completely other task
  • Introduce dataviewservice.Service with all gataview-related methods drawn from block.Service
  • Remove BlockDataviewRelationListAvailable from protocol

@KirillSto KirillSto requested review from deff7 and fat-fellow October 2, 2024 19:01
@KirillSto KirillSto self-assigned this Oct 2, 2024
Copy link

github-actions bot commented Oct 2, 2024

Previous Coverage 48.4% of statements
New Coverage 48.5% of statements
Patch Coverage 24.2% of changed statements (56/231)

Coverage provided by /~https://github.com/seriousben/go-patch-cover-action

st := sb.NewStateCtx(ctx)

// nolint:errcheck
_ = st.Iterate(func(b simple.Block) (isContinue bool) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

encapsulate this in simple/dataview block

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if dv := b.Model().GetDataview(); dv != nil {
				for _, view := range dv.Views {
					view.DefaultTemplateId = ""
					view.DefaultObjectTypeId = ""
				}
				st.Set(b)
				return false
			}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have implemented separate method in editor.Dataview for setting source in sets

@KirillSto KirillSto requested a review from deff7 October 3, 2024 15:32
view.DefaultTemplateId = ""
view.DefaultObjectTypeId = ""
if err = dv.SetView(view.Id, *view); err != nil {
log.With("objectId", d.Id()).Errorf("failed to update view '%s' of set: %v", view.Id, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe return with error?

btw use log fields for anything except error

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@KirillSto KirillSto merged commit 4e7ac3a into main Oct 4, 2024
5 checks passed
@KirillSto KirillSto deleted the go-4168-set-source-rollback branch October 4, 2024 14:40
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants