event log: Fix crash when using default avatar. Closes #1331
This commit is contained in:
parent
1113607f01
commit
c5c5b4d4cf
|
@ -32,7 +32,7 @@
|
||||||
var entry_count = $(this).parent ().find ('dl').children ().length;
|
var entry_count = $(this).parent ().find ('dl').children ().length;
|
||||||
|
|
||||||
if (entry_count > 10)
|
if (entry_count > 10)
|
||||||
$(this).html ('Show all ' + entry_count + '…');
|
$(this).html ('Show all ' + entry_count);
|
||||||
else
|
else
|
||||||
$(this).hide ();
|
$(this).hide ();
|
||||||
});
|
});
|
||||||
|
|
|
@ -362,22 +362,12 @@ namespace SparkleShare {
|
||||||
html += Path.GetFileName (file_path) + "”</b>";
|
html += Path.GetFileName (file_path) + "”</b>";
|
||||||
html += "</div><div class='table-wrapper'><table>";
|
html += "</div><div class='table-wrapper'><table>";
|
||||||
|
|
||||||
int count = 0;
|
if (change_sets.Count > 0)
|
||||||
|
change_sets.RemoveAt (0);
|
||||||
|
|
||||||
foreach (SparkleChangeSet change_set in change_sets) {
|
foreach (SparkleChangeSet change_set in change_sets) {
|
||||||
count++;
|
|
||||||
|
|
||||||
if (count == 1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string change_set_avatar = "file://<!-- $pixmaps-path -->/user-icon-default.png";
|
|
||||||
|
|
||||||
if (Program.Controller.AvatarsEnabled) {
|
|
||||||
change_set_avatar = SparkleAvatars.GetAvatar (change_set.User.Email, 24, Program.Controller.Config.FullPath);
|
|
||||||
change_set_avatar = "file://" + change_set_avatar.Replace ("\\", "/");
|
|
||||||
}
|
|
||||||
|
|
||||||
html += "<tr>" +
|
html += "<tr>" +
|
||||||
"<td class='avatar'><img src='" + change_set_avatar + "'></td>" +
|
"<td class='avatar'><img src='" + GetAvatarFilePath (change_set.User) + "'></td>" +
|
||||||
"<td class='name'>" + change_set.User.Name + "</td>" +
|
"<td class='name'>" + change_set.User.Name + "</td>" +
|
||||||
"<td class='date'>" +
|
"<td class='date'>" +
|
||||||
change_set.Timestamp.ToString ("d MMM yyyy", CultureInfo.InvariantCulture) +
|
change_set.Timestamp.ToString ("d MMM yyyy", CultureInfo.InvariantCulture) +
|
||||||
|
@ -390,8 +380,6 @@ namespace SparkleShare {
|
||||||
file_path + "'>Restore…</a>" +
|
file_path + "'>Restore…</a>" +
|
||||||
"</td>" +
|
"</td>" +
|
||||||
"</tr>";
|
"</tr>";
|
||||||
|
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html += "</table></div>";
|
html += "</table></div>";
|
||||||
|
@ -472,13 +460,6 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string change_set_avatar = "file://<!-- $pixmaps-path -->/user-icon-default.png";
|
|
||||||
|
|
||||||
if (Program.Controller.AvatarsEnabled) {
|
|
||||||
change_set_avatar = SparkleAvatars.GetAvatar (change_set.User.Email, 48, Program.Controller.Config.FullPath);
|
|
||||||
change_set_avatar = "file://" + change_set_avatar.Replace ("\\", "/");
|
|
||||||
}
|
|
||||||
|
|
||||||
event_entry += "</dl>";
|
event_entry += "</dl>";
|
||||||
|
|
||||||
string timestamp = change_set.Timestamp.ToString ("H:mm");
|
string timestamp = change_set.Timestamp.ToString ("H:mm");
|
||||||
|
@ -492,7 +473,7 @@ namespace SparkleShare {
|
||||||
event_entries += event_entry_html.Replace ("<!-- $event-entry-content -->", event_entry)
|
event_entries += event_entry_html.Replace ("<!-- $event-entry-content -->", event_entry)
|
||||||
.Replace ("<!-- $event-user-name -->", change_set.User.Name)
|
.Replace ("<!-- $event-user-name -->", change_set.User.Name)
|
||||||
.Replace ("<!-- $event-user-email -->", change_set.User.Email)
|
.Replace ("<!-- $event-user-email -->", change_set.User.Email)
|
||||||
.Replace ("<!-- $event-avatar-url -->", change_set_avatar)
|
.Replace ("<!-- $event-avatar-url -->", GetAvatarFilePath (change_set.User))
|
||||||
.Replace ("<!-- $event-url -->", change_set.RemoteUrl.ToString ())
|
.Replace ("<!-- $event-url -->", change_set.RemoteUrl.ToString ())
|
||||||
.Replace ("<!-- $event-revision -->", change_set.Revision);
|
.Replace ("<!-- $event-revision -->", change_set.Revision);
|
||||||
|
|
||||||
|
@ -606,6 +587,20 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string GetAvatarFilePath (SparkleUser user)
|
||||||
|
{
|
||||||
|
if (!Program.Controller.AvatarsEnabled)
|
||||||
|
return "<!-- $pixmaps-path -->/user-icon-default.png";
|
||||||
|
|
||||||
|
string fetched_avatar = SparkleAvatars.GetAvatar (user.Email, 48, Program.Controller.Config.FullPath);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty (fetched_avatar))
|
||||||
|
return "file://" + fetched_avatar.Replace ("\\", "/");
|
||||||
|
else
|
||||||
|
return "<!-- $pixmaps-path -->/user-icon-default.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// All change sets that happened on a day
|
// All change sets that happened on a day
|
||||||
private class ActivityDay : List<SparkleChangeSet>
|
private class ActivityDay : List<SparkleChangeSet>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue