Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
714a81ad
Commit
714a81ad
authored
Dec 08, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the mock code for approval store.
parent
40097f97
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
45 deletions
+0
-45
app/assets/javascripts/merge_request_widget/approvals/stores/approvals_store.js.es6
...ge_request_widget/approvals/stores/approvals_store.js.es6
+0
-45
No files found.
app/assets/javascripts/merge_request_widget/approvals/stores/approvals_store.js.es6
View file @
714a81ad
(() => {
let singleton;
const adminUser =
'{"id":1,"email":"admin@example.com","created_at":"2016-10-17T17:21:34.545Z","updated_at":"2016-12-01T12:40:12.884Z","name":"Administrator","admin":true,"projects_limit":100,"skype":"","linkedin":"","twitter":"","authentication_token":"9PQj4RxcKbyQwG5uAykL","theme_id":2,"bio":"","username":"root","can_create_group":true,"can_create_team":false,"state":"active","color_scheme_id":1,"password_expires_at":null,"created_by_id":null,"last_credential_check_at":null,"avatar":{"url":"/uploads/user/avatar/1/avatar.png"},"hide_no_ssh_key":true,"website_url":"","admin_email_unsubscribed_at":null,"notification_email":"admin@example.com","hide_no_password":false,"password_automatically_set":false,"location":"","encrypted_otp_secret":null,"encrypted_otp_secret_iv":null,"encrypted_otp_secret_salt":null,"otp_required_for_login":false,"otp_backup_codes":null,"public_email":"","dashboard":"projects","project_view":"readme","consumed_timestep":null,"layout":"fixed","hide_project_limit":false,"note":null,"otp_grace_period_started_at":null,"ldap_email":false,"external":false,"organization":"","incoming_email_token":"3rkrn7wdxmeyds49fdmlk7376","authorized_projects_populated":true}';
class ApprovalsStore {
constructor(rootEl) {
...
...
@@ -13,62 +11,19 @@
}
init(rootEl) {
this.data = {};
const dataset = rootEl.dataset;
const approverNames = JSON.parse(dataset.approverNames);
this.assignToData({
approvedByUsers: JSON.parse(dataset.approvedByUsers),
approvalsRequired: Number(dataset.approvalsRequired),
approverNames,
approvalsLeft: Number(dataset.approvalsLeft),
userHasApproved: Boolean(true),
userCanApprove: Boolean(true),
});
}
assignToData(val) {
Object.assign(this.data, val);
}
/** TODO: remove after backend integerated */
approve() {
const approvedByUsers = this.data.approvedByUsers;
const approverNames = this.data.approverNames;
const userCanApprove = this.data.userCanApprove;
const index = approverNames.indexOf("Administrator");
approverNames.splice(index, 1);
approvedByUsers.push(JSON.parse(adminUser));
this.assignToData({
approverNames,
approvedByUsers,
userHasApproved: true,
userCanApprove: true,
approvalsLeft: this.data.approvalsLeft -= 1
});
}
unapprove() {
debugger;
const approverNames = this.data.approverNames;
const approvedByUsers = this.data.approvedByUsers;
approverNames.push("Administrator");
approvedByUsers.pop(0);
this.assignToData({
approverNames,
approvedByUsers,
userHasApproved: false,
userCanApprove: true,
approvalsLeft: this.data.approvalsLeft += 1
});
}
}
gl.MergeRequestWidget.ApprovalsStore = ApprovalsStore;
})();
// TODO: Document the weirdness of shared data because of the UI
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment