OUR-261 Favorite button not working

#OUR-261 Fixed
This commit is contained in:
Sebastiaan Janssen
2015-07-11 16:44:58 +02:00
parent 1e580cd9b6
commit 3b73aa0b07
3 changed files with 15 additions and 23 deletions
@@ -44,13 +44,12 @@
<section class="package-detail">
<div class="container">
<div class="row">
<div class="col-md-7">
<div class="package-detail-content">
<div class="vote">
<i class="icon-Hearts @(hasMemberVoted ? "liked" : null)"></i>
@if (Members.IsLoggedIn() == false || currentMember.Id == owner.Id || currentMember.GetPropertyValue<int>("reputationCurrent") < 70 || hasMemberVoted)
@if (Members.IsLoggedIn() == false || currentMember.Id == owner.Id || hasMemberVoted)
{
<span>@totalVotes votes</span>
}
@@ -77,7 +76,7 @@
@foreach (var image in screenshots)
{
<a class="fancybox" rel="gallery1" href="@our.Utils.GetScreenshotPath(image.Path)" title="">
<img src="@our.Utils.GetScreenshotPath(image.Path)" alt="" />
<img src="@our.Utils.GetScreenshotPath(image.Path)" alt=""/>
</a>
}
+1 -1
View File
@@ -31,7 +31,7 @@
<action type="wiki" alias="WikiUp" performerReward="1" receiverReward="0" weight="1" minReputation="70" />
<action type="wiki" alias="WikiDown" performerReward="0" mandatoryComment="true" receiverReward="0" weight="-1" minReputation="70" />
<action type="project" alias="ProjectUp" performerReward="0" receiverReward="5" weight="1" minReputation="70" />
<action type="project" alias="ProjectUp" performerReward="0" receiverReward="5" weight="1" minReputation="0" />
<action type="project" alias="ProjectDown" mandatoryComment="true" performerReward="0" receiverReward="0" weight="-1" minReputation="70" />
<action type="project" alias="ProjectApproval" mandatoryComment="false" allowedGroups="admin,HQ" performerReward="0" receiverReward="0" weight="10" minReputation="0" />
+11 -18
View File
@@ -1,7 +1,7 @@
using System;
using umbraco.cms.businesslogic.web;
using uPowers.BusinessLogic;
using Umbraco.Core;
using Umbraco.Web;
namespace our.CustomHandlers
{
@@ -20,20 +20,13 @@ namespace our.CustomHandlers
if (a.Alias == "ProjectUp")
{
Document d = new Document(e.ItemId);
if (d.getProperty("approved").Value != null &&
d.getProperty("approved").Value.ToString() != "1" &&
uPowers.Library.Xslt.Score(d.Id, "powersProject") >= 15)
var contentService = UmbracoContext.Current.Application.Services.ContentService;
var content = contentService.GetById(e.ItemId);
if (content.GetValue<bool>("approved") == false &&
uPowers.Library.Xslt.Score(content.Id, "powersProject") >= 15)
{
//set approved flag
d.getProperty("approved").Value = true;
d.Save();
d.Publish(new umbraco.BusinessLogic.User(0));
umbraco.library.UpdateDocumentCache(d.Id);
umbraco.library.RefreshContent();
content.SetValue("approved", true);
contentService.SaveAndPublishWithStatus(content);
}
}
}
@@ -44,12 +37,12 @@ namespace our.CustomHandlers
if (a.Alias == "ProjectUp" || a.Alias == "ProjectDown")
{
var contentService = UmbracoContext.Current.Application.Services.ContentService;
var content = contentService.GetById(e.ItemId);
Document d = new Document(e.ItemId);
e.ReceiverId = content.GetValue<int>("owner");
e.ReceiverId = (int)d.getProperty("owner").Value;
e.ExtraReceivers = Utils.GetProjectContributors(d.Id);
e.ExtraReceivers = Utils.GetProjectContributors(content.Id);
}
}
}