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

Support OR conditions for content extract #197

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

christianseel
Copy link

What does it do ?

With this change it's possible to define OR conditions in the .gitify config for content extraction. The config could look like this:

  contents:
    type: content
    where:
      -
        'context_key:IN': [web,othercontext]
      -
        'OR:parent:IN': [480,510]

Why is it needed ?

Previously the condition for the current extracting context was added like this $contextCriteria['context_key'] = $contextKey; - this would destroy the array structure that is needed for the OR condition. With OR conditions you need to add conditions into the sub-arrays.

Related issue(s)/PR(s)

@christianseel
Copy link
Author

@Mark-H Can we get this merged? pretty please

hugopeek added a commit to hugopeek/Gitify that referenced this pull request Mar 20, 2019
@sonicpunk
Copy link
Contributor

@Mark-H Don't we want to merge this? This has been working for us internally since 2016.

@hugopeek
Copy link
Contributor

I'm also using this change for a while now, but just ran into an issue.

I can't limit the extract to a specific context with the following config:

    content:
        type: content
        exclude_keys:
            - editedby
            - editedon
        truncate_on_force:
            - modTemplateVarResource
        where:
            - 'context_key': 'global'

All contexts are extracted in this case. Reverting the changes in this PR solves it.

Changing the where clause to 'context_key:IN': [global] solves it too btw, as a temporary workaround..

@Mark-H
Copy link
Member

Mark-H commented Oct 10, 2021

Might be more logical to filter one level up (i.e. here). The way content is extracted is grouped into directories by context, so if we don't want certain contexts... just don't load those contexts.

That could be a new property on the content definition, like:

  contents:
    type: content
    contexts: [web, othercontext]

I don't know why I left this one so long, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants