Merge branch 'hotfix/21.56.9' into master
[gitter.git] / server / event-listeners / room-permissions-change-listener.js
blob232988ab4d40a27d260a2ca809545695d30eb5b7
1 'use strict';
3 var appEvents = require('gitter-web-appevents');
4 var roomService = require('gitter-web-rooms');
6 var installed = false;
7 exports.install = function() {
8   if (installed) return;
9   installed = true;
11   appEvents.onRepoPermissionsChangeDetected(function(data) {
12     var uri = data.uri;
13     var isPrivate = data.isPrivate;
15     if (isPrivate) {
16       roomService.ensureRepoRoomSecurity(uri, 'PRIVATE');
17     } else {
18       roomService.ensureRepoRoomSecurity(uri, 'PUBLIC');
19     }
20   });