mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Fix fatal on logged out Phame Post
Summary: Just deletes the view code until I have time to better plan this out, or just not ship. Test Plan: Visit Phame post on public logged out page, view count doesnt cause transaction fatal. Reviewers: epriestley Reviewed By: epriestley Spies: Korvin Differential Revision: https://secure.phabricator.com/D18475
This commit is contained in:
parent
213e4ec9b5
commit
79c6b50049
6 changed files with 3 additions and 60 deletions
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_phame.phame_post
|
||||
DROP COLUMN views;
|
|
@ -4421,7 +4421,6 @@ phutil_register_library_map(array(
|
|||
'PhamePostTransactionQuery' => 'applications/phame/query/PhamePostTransactionQuery.php',
|
||||
'PhamePostTransactionType' => 'applications/phame/xaction/PhamePostTransactionType.php',
|
||||
'PhamePostViewController' => 'applications/phame/controller/post/PhamePostViewController.php',
|
||||
'PhamePostViewsTransaction' => 'applications/phame/xaction/PhamePostViewsTransaction.php',
|
||||
'PhamePostVisibilityTransaction' => 'applications/phame/xaction/PhamePostVisibilityTransaction.php',
|
||||
'PhameSchemaSpec' => 'applications/phame/storage/PhameSchemaSpec.php',
|
||||
'PhameSite' => 'applications/phame/site/PhameSite.php',
|
||||
|
@ -10054,7 +10053,6 @@ phutil_register_library_map(array(
|
|||
'PhamePostTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||
'PhamePostTransactionType' => 'PhabricatorModularTransactionType',
|
||||
'PhamePostViewController' => 'PhameLiveController',
|
||||
'PhamePostViewsTransaction' => 'PhamePostTransactionType',
|
||||
'PhamePostVisibilityTransaction' => 'PhamePostTransactionType',
|
||||
'PhameSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
'PhameSite' => 'PhabricatorSite',
|
||||
|
|
|
@ -18,25 +18,6 @@ final class PhamePostViewController
|
|||
$is_live = $this->getIsLive();
|
||||
$is_external = $this->getIsExternal();
|
||||
|
||||
// Register a blog "view" count
|
||||
//
|
||||
if (!$post->isDraft() && !$post->isArchived()) {
|
||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||
$xactions = array();
|
||||
$xactions[] = id(new PhamePostTransaction())
|
||||
->setTransactionType(PhamePostViewsTransaction::TRANSACTIONTYPE)
|
||||
->setNewValue(null);
|
||||
|
||||
$editor = id(new PhamePostEditor())
|
||||
->setActor($viewer)
|
||||
->setContentSourceFromRequest($request)
|
||||
->setContinueOnMissingFields(true)
|
||||
->setContinueOnNoEffect(true);
|
||||
|
||||
$editor->applyTransactions($post, $xactions);
|
||||
unset($unguarded);
|
||||
}
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->addClass('phame-header-bar')
|
||||
->setUser($viewer);
|
||||
|
@ -170,11 +151,6 @@ final class PhamePostViewController
|
|||
->setUser($viewer)
|
||||
->setObject($post);
|
||||
|
||||
$views = id(new PhutilNumber($post->getViews()));
|
||||
$properties->addProperty(
|
||||
pht('Views'),
|
||||
pht('%s', $views));
|
||||
|
||||
$is_live = $this->getIsLive();
|
||||
$is_external = $this->getIsExternal();
|
||||
$next_view = new PhameNextPostView();
|
||||
|
|
|
@ -32,12 +32,6 @@ final class PhamePostEditor
|
|||
if ($object->isDraft() || ($object->isArchived())) {
|
||||
return false;
|
||||
}
|
||||
foreach ($xactions as $xaction) {
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case PhamePostViewsTransaction::TRANSACTIONTYPE:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -47,12 +41,6 @@ final class PhamePostEditor
|
|||
if ($object->isDraft() || $object->isArchived()) {
|
||||
return false;
|
||||
}
|
||||
foreach ($xactions as $xaction) {
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case PhamePostViewsTransaction::TRANSACTIONTYPE:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ final class PhamePost extends PhameDAO
|
|||
protected $phameTitle;
|
||||
protected $body;
|
||||
protected $visibility;
|
||||
protected $views;
|
||||
protected $configData;
|
||||
protected $datePublished;
|
||||
protected $blogPHID;
|
||||
|
@ -41,8 +40,7 @@ final class PhamePost extends PhameDAO
|
|||
->setBlogPHID($blog->getPHID())
|
||||
->attachBlog($blog)
|
||||
->setDatePublished(PhabricatorTime::getNow())
|
||||
->setVisibility(PhameConstants::VISIBILITY_PUBLISHED)
|
||||
->setViews(0);
|
||||
->setVisibility(PhameConstants::VISIBILITY_PUBLISHED);
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
@ -130,7 +128,6 @@ final class PhamePost extends PhameDAO
|
|||
'subtitle' => 'text64',
|
||||
'phameTitle' => 'sort64?',
|
||||
'visibility' => 'uint32',
|
||||
'views' => 'uint32',
|
||||
'mailKey' => 'bytes20',
|
||||
'headerImagePHID' => 'phid?',
|
||||
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhamePostViewsTransaction
|
||||
extends PhamePostTransactionType {
|
||||
|
||||
const TRANSACTIONTYPE = 'phame.post.views';
|
||||
|
||||
public function generateOldValue($object) {
|
||||
return $object->getViews();
|
||||
}
|
||||
|
||||
public function applyInternalEffects($object, $value) {
|
||||
$views = $object->getViews();
|
||||
$views++;
|
||||
$object->setViews($views);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue