mirror of
https://github.com/wekan/wekan.git
synced 2026-01-06 09:38:49 +01:00
Centralize all mutations at the model level
This commit uses a new package that I need to document. It tries to solve the long-standing debate in the Meteor community about allow/deny rules versus methods (RPC). This approach gives us both the centralized security rules of allow/deny and the white-list of allowed mutations similarly to Meteor methods. The idea to have static mutation descriptions is also inspired by Facebook's Relay/GraphQL. This will allow the development of a REST API using the high-level methods instead of the MongoDB queries to do the mapping between the HTTP requests and our collections.
This commit is contained in:
parent
c04341f1ea
commit
45b662a1dd
26 changed files with 395 additions and 377 deletions
|
|
@ -7,8 +7,8 @@ Template.boardMenuPopup.events({
|
|||
'click .js-change-board-color': Popup.open('boardChangeColor'),
|
||||
'click .js-change-language': Popup.open('changeLanguage'),
|
||||
'click .js-archive-board ': Popup.afterConfirm('archiveBoard', () => {
|
||||
const boardId = Session.get('currentBoard');
|
||||
Boards.update(boardId, { $set: { archived: true }});
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
currentBoard.archive();
|
||||
// XXX We should have some kind of notification on top of the page to
|
||||
// confirm that the board was successfully archived.
|
||||
FlowRouter.go('home');
|
||||
|
|
@ -17,13 +17,9 @@ Template.boardMenuPopup.events({
|
|||
|
||||
Template.boardChangeTitlePopup.events({
|
||||
submit(evt, tpl) {
|
||||
const title = tpl.$('.js-board-name').val().trim();
|
||||
if (title) {
|
||||
Boards.update(this._id, {
|
||||
$set: {
|
||||
title,
|
||||
},
|
||||
});
|
||||
const newTitle = tpl.$('.js-board-name').val().trim();
|
||||
if (newTitle) {
|
||||
this.rename(newTitle);
|
||||
Popup.close();
|
||||
}
|
||||
evt.preventDefault();
|
||||
|
|
@ -95,12 +91,9 @@ BlazeComponent.extendComponent({
|
|||
events() {
|
||||
return [{
|
||||
'click .js-select-background'(evt) {
|
||||
const currentBoardId = Session.get('currentBoard');
|
||||
Boards.update(currentBoardId, {
|
||||
$set: {
|
||||
color: this.currentData().toString(),
|
||||
},
|
||||
});
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
const newColor = this.currentData().toString();
|
||||
currentBoard.setColor(newColor);
|
||||
evt.preventDefault();
|
||||
},
|
||||
}];
|
||||
|
|
@ -168,11 +161,9 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
selectBoardVisibility() {
|
||||
Boards.update(Session.get('currentBoard'), {
|
||||
$set: {
|
||||
permission: this.currentData(),
|
||||
},
|
||||
});
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
const visibility = this.currentData();
|
||||
currentBoard.setVisibility(visibility);
|
||||
Popup.close();
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue