To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit a084d7dc authored by Hermann's avatar Hermann
Browse files

fix bug: adding group to a user

parent 8c6e767b
......@@ -125,7 +125,7 @@ export class ResourceHandler {
const fullQuery = {};
if ('search' in query && query.search.length > 0) {
if ('search' in query && query.search && query.search.length > 0) {
// translate search into where, we just look if any field contains search
// The search-string may match any of the keys in the object specified in the
// constructor
......@@ -134,7 +134,7 @@ export class ResourceHandler {
const fieldQuery = {};
fieldQuery[key] = {
$regex: `${query.search}`,
$options: 'i'
$options: 'i',
};
return fieldQuery;
}),
......@@ -146,7 +146,7 @@ export class ResourceHandler {
} else {
fullQuery.where = JSON.stringify(searchQuery);
}
} else if (query.where) {
} else if ('where' in query) {
fullQuery.where = JSON.stringify(query.where);
}
......
......@@ -26,7 +26,7 @@ export default class UserView extends ItemView {
// a controller to handle the list of possible groups to join
this.groupcontroller = new DatalistController('groups', {}, ['name']);
// exclude the groups where the user is already a member
this.groupmemberships.handler.get({ where: { user: this.id } })
this.groupmemberships.handler.get({ where: { user: this.data._id } })
.then((data) => {
const groupIds = data._items.map(item => item.group);
this.groupcontroller.setQuery({
......@@ -71,7 +71,8 @@ export default class UserView extends ItemView {
// groupmemberships. Selects a group to request membership for.
const groupSelect = m(SelectList, {
controller: this.groupcontroller,
listTileAttrs: data => Object.assign({}, { title: data.name }),
listTileAttrs: group => Object.assign({}, { title: group.name }),
selectedText: group => group.name,
onSubmit: (group) => {
this.groupchoice = false;
this.groupmemberships.handler.post({
......@@ -81,6 +82,7 @@ export default class UserView extends ItemView {
this.groupmemberships.refresh();
});
},
onCancel: () => { this.groupchoice = false; m.redraw(); },
});
return this.layout([
......@@ -119,7 +121,7 @@ export default class UserView extends ItemView {
m('div.viewcontainercolumn', m(Card, {
style: { height: '300px' },
content: m('div', [
this.groupchoice ? groupSelect : '',
this.groupchoice && groupSelect,
m(Toolbar, { compact: true }, [
m(ToolbarTitle, { text: 'Group Memberships' }),
m(Button, {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment