Skip to content

Commit

Permalink
fix(web): allow repos in groups to work properly
Browse files Browse the repository at this point in the history
Still need to init with `private`, though.
  • Loading branch information
dsevillamartin committed Jul 21, 2017
1 parent 0a57dfa commit d290ada
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Web.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ app.post('/', (req, res) => {

if (!event || !data || !data.project) return res.status(403).send('Invalid data. Plz use Gitlab webhooks.');

const repo = data.project.path_with_namespace;
const repoMatch = /(\S+?)(?:\/\S+)?\/(\S+)/.exec(data.project.path_with_namespace);
const repo = `${repoMatch[1]}/${repoMatch[2]}`;
const channels = ChannelConfig.FindByRepo(repo);
const actionText = data.object_attributes && data.object_attributes.action ? `/${data.object_attributes.action}` : '';
Log.verbose(`GitLab | ${repo} - ${eventName}${actionText} (${channels.size} channels)`);
res.send(`${repo} : Received ${eventName}${actionText}, emitting to ${channels.size} channels...`);
res.send(`${data.project.path_with_namespace} : Received ${eventName}${actionText}, emitting to ${channels.size} channels...`);
const eventResponse = GitlabEventHandler.use(data, event);

const handleError = (resp, channel) => {
Expand Down

0 comments on commit d290ada

Please sign in to comment.