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
MM-14897: Changes to be able to add and remove groups from channels. #10794
Conversation
bd93fb8
to
1123490
Compare
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.
I have some improvements proposals, but in general looks good to me.
Where("ug.DeleteAt = 0 AND gt.TeamId = ? AND gt.DeleteAt = 0", teamID) | ||
From(fmt.Sprintf("%s gs", table)). | ||
LeftJoin("UserGroups ug ON gs.GroupId = ug.Id"). | ||
Where(fmt.Sprintf("ug.DeleteAt = 0 AND gs.%s = ? AND gs.DeleteAt = 0", idCol), syncableID) |
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.
I don't like this "query building" approach. I would prefer something more simple like building the entire query two times one for each syncable type. (probably in the query some lines later you can reuse a chunk of the query. Anyway, up to you, feel free to merge it as is, if you think is the best option.
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.
@jespino I had the same thought as you when it was being written. Perhaps it's tipping the scale towards "too clever" instead of being repetitive. The impetus for doing it this way was that it's such a long query to repeat twice. Is the risk from the repetition worth the risk from the added complexity of interpolating the string? I don't think there's a definitive answer.
Summary
Changes to be able to add and remove groups from channels.
Pretty similar to some of the changes from #10701 but for Channels.
Ticket Link
https://mattermost.atlassian.net/browse/MM-14897