-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add setting per-autolink for allowing bot posts #160
Conversation
Codecov Report
@@ Coverage Diff @@
## master #160 +/- ##
==========================================
- Coverage 41.20% 40.79% -0.41%
==========================================
Files 6 6
Lines 665 679 +14
==========================================
+ Hits 274 277 +3
- Misses 371 382 +11
Partials 20 20
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If @aaronrothschild is fine with this, I'm also
@hanzei Most of the consensus around blocking bot posts in the first place was that this should be a per-link setting, and I didn't want to force an admin to make a hard decision of global enable/disable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hanzei The specific test failing is failing because it defends against fetching the bot user until we have determined that the text has changed by any one of the autolinks. I see two paths here:
|
@mickmister Can we combine the two things and only fetch the bot once in the loop? Something like:
|
@hanzei By default all links will have var user *model.user
for _, link := range conf.Links {
if !p.inScope(link.Scope, channelName, teamName) {
continue
}
processed := link.Replace(newText)
if processed == newText {
continue
}
if !link.ProcessBotPosts {
if user == nil {
// fetch user
}
if user.IsBot() {
continue
}
}
newText = processed
} |
@mickmister |
@hanzei No, the default behavior has not changed in this PR. I think the confusion may be around the Before the PR:
After this PR (let's just assume the default setting to compare with previous behavior):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@mickmister do you have any thoughts on @vinod-demansol's comments above. We should also add info to the help on how the new functionality is set. |
@DHaussermann I'm not sure when I will have the cycles to address the issues above. @aaronrothschild Are these items a requirement for releasing this feature? Maybe we can assign this PR to someone from Demansol?
@vinod-demansol Can you please explain what you mean by "I am able to edit Bot message"? What steps did you take to test (the "editing" part of the test), what was the expected outcome, and what happened instead? |
@mickmister Let's try to ship it as is, those missing commands aren't blockers, but should be in the next release fo Autolink. It seems we have some customers waiting for this, so I am inclined to ship as is. Then add a new ticket for 1.4.0. Captured the leftover work to be done here #182 |
@vinod-demansol What do you think about the comment above? #160 (comment) |
I am ok if its tracked in new ticket in 1.4.0 |
Steps i followed
steps I followed
|
@vinod-demansol What is the difference between the expected behaviour and the one that you are seeing? |
curl -i -X POST -H 'Content-Type: application/json' -d '{"channel_id":<>, "message":"This is a message from a bot with mention for @dkh-sysadmin and @dkh-member", "props":{"attachments": [{"pretext": "LHS","text": "LHS"}]}}' -H 'Authorization: Bearer <>' https://demansol-sandbox.test.mattermost.cloud/api/v4/posts @mickmister when i make a bot post using this curl script, i don't see the post re-written by autolink in the mattermost. can you pls provide a valid curl script in case its a user error. |
@dipak-demansol What part of the message do you expect to be re-written? FYI: Slack attachments where never meant to be re-written. |
@dipak-demansol I agree with @hanzei, it seems you are expecting If that's the case, we should indeed expect the text to not change, so what you're seeing is not a bug in this case. |
@mickmister can you pls provide me the repro steps to regenerate the issue. |
yes i was expecting that. i misunderstood the issue so can you pls provide me the repro steps to generate the issue and then i'll test it properly. |
Then perform these three tests:
|
@dipak-demansol and I tested this. I does seem functional but there are some limitations the really impact usability. We were unaware that this was a link level config setting and not a plugin level config. (This info was provided on this PR but we need end user facing details.) This is not discoverable and can only be configured via the UI.
|
@dipak-demansol These issues are now addressed
|
With master build when i add Bot post then LHS is not rewritten and its expected, if i try to set ProcessBotPosts True in old build then i'll get this kind of response. :- With the PR build i'm able to set true the ProcessBotPosts and Now the bot post is rewritten so its LGTM. non blocking point:- testing with PR build i'm able to ProcessBotPosts set True/false but it would be great if the True/false also be the part of auto-suggestion.@mickmister After Discussing the same result with Dylan, if is there anything blocking then will update you, if all Good then i'll add tag as Qa review Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, as per the Discussion with Dylan, will add non-blocking point list on new tiket.
|
Summary
Currently, the plugin does not edit any posts made by bots. There is a customer wanting to use the autolink plugin with their own bot's posts. I've added a setting on each configured autolink to allow bot posts to be edited.
Thread for customer request:
https://community-daily.mattermost.com/core/pl/35ho6xwqepfppyb6wpx5fwqz9a
Ticket Link
Fixes #141
Related Issues/PRs
Issue - #94
Pull Request - #98