Commit 898cf02e authored by Phil Hughes's avatar Phil Hughes

added link to last commit message

changed font size of buttons
parent 8f76db4c
......@@ -166,8 +166,7 @@ export default {
<h4>
{{ __('All changes are committed') }}
</h4>
<p>
{{ lastCommitMsg }}
<p v-html="lastCommitMsg">
</p>
</div>
</div>
......
......@@ -25,7 +25,8 @@ export const updateBranchName = ({ commit }, branchName) => {
commit(types.UPDATE_NEW_BRANCH_NAME, branchName);
};
export const setLastCommitMessage = ({ commit }, data) => {
export const setLastCommitMessage = ({ rootState, commit }, data) => {
const currentProject = rootState.projects[rootState.currentProjectId];
const commitStats = data.stats ?
sprintf(
__('with %{additions} additions, %{deletions} deletions.'),
......@@ -35,9 +36,10 @@ export const setLastCommitMessage = ({ commit }, data) => {
const commitMsg = sprintf(
__('Your changes have been committed. Commit %{commitId} %{commitStats}'),
{
commitId: data.short_id,
commitId: `<a href="${currentProject.web_url}/commit/${data.short_id}" class="commit-sha">${data.short_id}</a>`,
commitStats,
},
false,
);
commit(rootTypes.SET_LAST_COMMIT_MSG, commitMsg, { root: true });
......@@ -144,6 +146,7 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState }) =
}
})
.catch((err) => {
console.log(err);
let errMsg = __('Error committing changes. Please try again.');
if (err.response.data && err.response.data.message) {
errMsg += ` (${stripHtml(err.response.data.message)})`;
......
......@@ -466,6 +466,10 @@ table.table tr td.multi-file-table-name {
.multi-file-commit-form {
padding: $gl-padding;
border-top: 1px solid $white-dark;
.btn {
font-size: $gl-font-size;
}
}
.multi-file-commit-message.form-control {
......
......@@ -58,10 +58,23 @@ describe('IDE commit module actions', () => {
});
describe('setLastCommitMessage', () => {
beforeEach(() => {
Object.assign(store.state, {
currentProjectId: 'abcproject',
projects: {
abcproject: {
web_url: 'http://testing',
},
},
});
});
it('updates commit message with short_id', (done) => {
store.dispatch('commit/setLastCommitMessage', { short_id: '123' })
.then(() => {
expect(store.state.lastCommitMsg).toContain('Your changes have been committed. Commit 123');
expect(store.state.lastCommitMsg).toContain(
'Your changes have been committed. Commit <a href="http://testing/commit/123" class="commit-sha">123</a>',
);
})
.then(done)
.catch(done.fail);
......@@ -76,7 +89,7 @@ describe('IDE commit module actions', () => {
},
})
.then(() => {
expect(store.state.lastCommitMsg).toBe('Your changes have been committed. Commit 123 with 1 additions, 2 deletions.');
expect(store.state.lastCommitMsg).toBe('Your changes have been committed. Commit <a href="http://testing/commit/123" class="commit-sha">123</a> with 1 additions, 2 deletions.');
})
.then(done)
.catch(done.fail);
......@@ -350,7 +363,7 @@ describe('IDE commit module actions', () => {
store.dispatch('commit/commitChanges')
.then(() => {
expect(store.state.lastCommitMsg).toBe(
'Your changes have been committed. Commit 123 with 1 additions, 2 deletions.',
'Your changes have been committed. Commit <a href="webUrl/commit/123" class="commit-sha">123</a> with 1 additions, 2 deletions.',
);
done();
......
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