Commit 7e07411a authored by Ivanq's avatar Ivanq

Use profile settings when committing

parent 1931a30f
......@@ -205,17 +205,24 @@ class Repository {
});
}
saveFile(path, content, base, message) {
let author, commit, parent;
let auth, author, commit, parent;
return this.zeroAuth.requestAuth()
.then(auth => {
.then(a => {
auth = a;
return this.zeroFS.readFile("data/users/" + auth.address + "/data.json");
})
.then(profile => {
profile = JSON.parse(profile);
let date = new Date;
let tz = date.getTimezoneOffset() * -1;
let hours = Math.floor(Math.abs(tz / 60));
let minutes = Math.abs((tz + 60) % 60);
tz = (tz > 0 ? "+" : "-") + (hours < 10 ? "0" : "") + hours + (minutes < 10 ? "0" : "") + minutes;
author = auth.user[0].toUpperCase() + auth.user.substr(1).replace(/@.*/, "");
author += " <" + auth.user + ">";
author = profile.commitName || auth.user[0].toUpperCase() + auth.user.substr(1).replace(/@.*/, "");
author += " <" + (profile.commitEmail || auth.user) + ">";
author += " " + Math.floor(+date / 1000);
author += " " + tz;
......
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