Gitify icon indicating copy to clipboard operation
Gitify copied to clipboard

Support OR conditions for content extract

Open christianseel opened this issue 9 years ago • 4 comments

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 avatar Jul 21 '16 16:07 christianseel

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

christianseel avatar Nov 07 '16 09:11 christianseel

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

sonicpunk avatar Apr 16 '20 08:04 sonicpunk

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..

hugopeek avatar May 11 '20 10:05 hugopeek

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.

Mark-H avatar Oct 10 '21 15:10 Mark-H