Merge pull request #1157 from MrPetovan/task/advancecontentfilter-attachments
[advancedcontentfilter] Add new attachments key in filter
This commit is contained in:
commit
da159e9d2c
1 changed files with 11 additions and 0 deletions
|
@ -282,6 +282,7 @@ function advancedcontentfilter_build_fields($data)
|
|||
'event_created', 'event_edited', 'event_start', 'event_finish', 'event_summary',
|
||||
'event_desc', 'event_location', 'event_type', 'event_nofinish', 'event_adjust', 'event_ignore',
|
||||
'children', 'pagedrop', 'tags', 'hashtags', 'mentions',
|
||||
'attachments',
|
||||
];
|
||||
|
||||
$expressionLanguage = new ExpressionLanguage\ExpressionLanguage();
|
||||
|
@ -360,6 +361,8 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request)
|
|||
|
||||
$rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => DBA::lastInsertId()]);
|
||||
|
||||
DI::cache()->delete('rules_' . local_user());
|
||||
|
||||
return json_encode(['message' => DI::l10n()->t('Rule successfully added'), 'rule' => $rule]);
|
||||
}
|
||||
|
||||
|
@ -389,6 +392,8 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res
|
|||
throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
|
||||
}
|
||||
|
||||
DI::cache()->delete('rules_' . local_user());
|
||||
|
||||
return json_encode(['message' => DI::l10n()->t('Rule successfully updated')]);
|
||||
}
|
||||
|
||||
|
@ -410,6 +415,8 @@ function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request,
|
|||
throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
|
||||
}
|
||||
|
||||
DI::cache()->delete('rules_' . local_user());
|
||||
|
||||
return json_encode(['message' => DI::l10n()->t('Rule successfully deleted')]);
|
||||
}
|
||||
|
||||
|
@ -437,6 +444,10 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques
|
|||
$item['hashtags'] = $tags['hashtags'];
|
||||
$item['mentions'] = $tags['mentions'];
|
||||
|
||||
$attachments = Post\Media::splitAttachments($item['uri-id'], $item['guid'] ?? '');
|
||||
|
||||
$item['attachments'] = $attachments;
|
||||
|
||||
$return = advancedcontentfilter_get_filter_fields($item);
|
||||
|
||||
return json_encode(['variables' => str_replace('\\\'', '\'', var_export($return, true))]);
|
||||
|
|
Loading…
Reference in a new issue