Skip to content

sunfeiyu/fix-enable-property-bug-on-log-trigger#473

Merged
tanhe123 merged 2 commits into
alibaba:masterfrom
coco-super:sunfeiyu/fix-enable-property-bug-on-log-trigger
Sep 29, 2019
Merged

sunfeiyu/fix-enable-property-bug-on-log-trigger#473
tanhe123 merged 2 commits into
alibaba:masterfrom
coco-super:sunfeiyu/fix-enable-property-bug-on-log-trigger

Conversation

@coco-super
Copy link
Copy Markdown
Collaborator

Log 触发器,fun deploy 时 Enable 开关属性没有生效。

Comment thread lib/trigger.js Outdated
functionParameter: logConfig.FunctionParameter || {}
},
Enable: triggerProperties.Enable || true
Enable: (triggerProperties.Enable === false) ? false : true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

triggerProperties.Enable !== true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

triggerProperties.Enable 是来自于 yaml 么?

如果想兼容 true 和 'true' 这两种情况,可以参考
https://stackoverflow.com/a/57923478

!!triggerProperties.Enable === true

Copy link
Copy Markdown
Collaborator Author

@coco-super coco-super Sep 29, 2019

Choose a reason for hiding this comment

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

1.triggerProperties.Enable !== true 时,属性为为空时,表达式的值为 false 不符合预期(预期是:不填写时默认为 true)
2. 不需要做到兼容,因为 fun 有 schema 的校验,当 Enable 属性为非 布尔 型时,会抛出错误。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(triggerProperties.Enable === false) ? false : true
等价于
!(triggerProperties.Enable === false)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

Comment thread lib/trigger.js Outdated
functionParameter: logConfig.FunctionParameter || {}
},
Enable: triggerProperties.Enable || true
Enable: (triggerProperties.Enable === false) ? false : true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

triggerProperties.Enable 是来自于 yaml 么?

如果想兼容 true 和 'true' 这两种情况,可以参考
https://stackoverflow.com/a/57923478

!!triggerProperties.Enable === true

@tanhe123 tanhe123 merged commit f0371ca into alibaba:master Sep 29, 2019
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.

3 participants