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

Cannot change "Post as" value for incoming webhook integration #6869

Closed
TheSharpieOne opened this issue May 3, 2017 · 1 comment · Fixed by #6903
Closed

Cannot change "Post as" value for incoming webhook integration #6869

TheSharpieOne opened this issue May 3, 2017 · 1 comment · Fixed by #6903
Assignees
Milestone

Comments

@TheSharpieOne
Copy link

Rocket.Chat Version: 0.52.0
Running Instances: 1
DB Replicaset OpLog: Disabled
Node Version: 4.8.2 - x64

Not 100% sure why I am not able to change the "Post as" username. What is the logic / reason for not allowing this value to change?
Why does this matter?

const user = RocketChat.models.Users.findOne({ username: currentIntegration.username });
RocketChat.models.Roles.addUserRoles(user._id, 'bot');

That assume the user exists... but in my case, someone deleted the user the webhooks were assigned to.... which gives me the following error:

Exception while invoking method 'updateIncomingIntegration' TypeError: Cannot read property 'id' of undefined at [object Object].Meteor.methods.updateIncomingIntegration (/opt/Rocket.Chat/programs/server/packages/rocketchat_integrations.js:509:46) at [object Object].methodsMap.(anonymous function) (/opt/Rocket.Chat/programs/server/packages/rocketchat_lib.js:1064:26) at maybeAuditArgumentChecks (/opt/Rocket.Chat/programs/server/packages/ddp-server.js:2108:12) at /opt/Rocket.Chat/programs/server/packages/ddp-server.js:1042:22 at [object Object]..extend.withValue (packages/meteor.js:1122:17) at /opt/Rocket.Chat/programs/server/packages/ddp-server.js:1041:43 at [object Object]._.extend.withValue (packages/meteor.js:1122:17) at /opt/Rocket.Chat/programs/server/packages/ddp-server.js:1040:48 at Session.method (/opt/Rocket.Chat/programs/server/packages/ddp-server.js:1018:23) at /opt/Rocket.Chat/programs/server/packages/ddp-server.js:880:89

Another thing is... before all of this happened, I created new bot accounts and change the post as to use the new bot accounts and not the "admin" which was set there before by the person who originally created the webhooks.
"Why not just delete these hooks and create new ones?" Great question. When I create a new webhook, I get a new URL/token... which means I would need to change those values in the various applications which I do not have admin access to, which makes it a real pain.

@graywolf336
Copy link
Contributor

👍 I will work on a solution for this first thing tomorrow as you're right, it doesn't even look like the update includes the new username...I wonder if this got lost in the coffeescript to JavaScript conversion

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

Successfully merging a pull request may close this issue.

4 participants