Commit b53b5f5c authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'mr-widget-approvals-improvement' into 'master'

MRWidget: Remove approved from serializer.

See merge request !1933
parents 1188042d 1c6aa5c7
...@@ -19,6 +19,11 @@ export default { ...@@ -19,6 +19,11 @@ export default {
isMakingRequest: false, isMakingRequest: false,
}; };
}, },
computed: {
isApprovalsLeft() {
return this.mr.approvals && this.mr.approvalsLeft;
},
},
methods: { methods: {
rebase() { rebase() {
this.isMakingRequest = true; this.isMakingRequest = true;
...@@ -82,7 +87,7 @@ export default { ...@@ -82,7 +87,7 @@ export default {
<div class="accept-merge-holder clearfix js-toggle-container accept-action"> <div class="accept-merge-holder clearfix js-toggle-container accept-action">
<button <button
class="btn btn-small btn-reopen btn-success" class="btn btn-small btn-reopen btn-success"
:disabled="mr.approvalsLeft || isMakingRequest" :disabled="isApprovalsLeft || isMakingRequest"
@click="rebase"> @click="rebase">
<i <i
v-if="isMakingRequest" v-if="isMakingRequest"
...@@ -98,7 +103,7 @@ export default { ...@@ -98,7 +103,7 @@ export default {
</div> </div>
<div class="mr-info-list"> <div class="mr-info-list">
<div class="legend"></div> <div class="legend"></div>
<p v-if="mr.approvalsLeft"> <p v-if="isApprovalsLeft">
Rebasing is disabled until merge request has been approved. Rebasing is disabled until merge request has been approved.
</p> </p>
</div> </div>
......
...@@ -31,7 +31,7 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -31,7 +31,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
} }
initApprovals(data) { initApprovals(data) {
this.isApproved = data.approved || false; this.isApproved = this.isApproved || false;
this.approvals = this.approvals || null; this.approvals = this.approvals || null;
this.approvalsPath = data.approvals_path || this.approvalsPath; this.approvalsPath = data.approvals_path || this.approvalsPath;
this.approvalsRequired = Boolean(this.approvalsPath); this.approvalsRequired = Boolean(this.approvalsPath);
...@@ -40,7 +40,7 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -40,7 +40,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
setApprovals(data) { setApprovals(data) {
this.approvals = data; this.approvals = data;
this.approvalsLeft = !!data.approvals_left; this.approvalsLeft = !!data.approvals_left;
this.isApproved = data.approved || !this.approvalsLeft || false; this.isApproved = !this.approvalsLeft || false;
this.preventMerge = this.approvalsRequired && this.approvalsLeft; this.preventMerge = this.approvalsRequired && this.approvalsLeft;
} }
} }
...@@ -21,7 +21,6 @@ class MergeRequestEntity < IssuableEntity ...@@ -21,7 +21,6 @@ class MergeRequestEntity < IssuableEntity
expose :rebase_commit_sha expose :rebase_commit_sha
expose :rebase_in_progress?, as: :rebase_in_progress expose :rebase_in_progress?, as: :rebase_in_progress
expose :should_be_rebased?, as: :should_be_rebased expose :should_be_rebased?, as: :should_be_rebased
expose :approved?, as: :approved
expose :ff_only_enabled do |merge_request| expose :ff_only_enabled do |merge_request|
merge_request.project.merge_requests_ff_only_enabled merge_request.project.merge_requests_ff_only_enabled
end end
......
...@@ -51,7 +51,6 @@ describe MergeRequestEntity do ...@@ -51,7 +51,6 @@ describe MergeRequestEntity do
## EE ## EE
:can_push_to_source_branch, :approvals_before_merge, :can_push_to_source_branch, :approvals_before_merge,
:squash, :rebase_commit_sha, :rebase_in_progress, :squash, :rebase_commit_sha, :rebase_in_progress,
:approved, :should_be_rebased, :rebase_path,
:approvals_path, :ff_only_enabled) :approvals_path, :ff_only_enabled)
end end
......
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