Skip to content

Commit 4cf8bde

Browse files
committed
Fixed unpublished entry bug.
1 parent 1637680 commit 4cf8bde

5 files changed

Lines changed: 18 additions & 19 deletions

File tree

boost/boost.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* MA 02110-1301 USA
2020
*/
2121
$proper_name = 'Stories';
22-
$version = '1.6.1';
22+
$version = '1.6.2';
2323
$register = false;
2424
$unregister = false;
2525
$import_sql = false;

boost/update.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ public function run()
104104
$this->update('1.6.0');
105105
case $this->compare('1.6.1'):
106106
$this->update('1.6.1');
107+
case $this->compare('1.6.2'):
108+
$this->update('1.6.2');
107109
}
108110
return $this->content;
109111
}
@@ -351,6 +353,12 @@ private function v1_6_1()
351353
$changes[] = 'Fixed bugs with publish date.';
352354
$this->addContent('1.6.1', $changes);
353355
}
356+
357+
private function v1_6_2()
358+
{
359+
$changes[] = 'Fixed bug with unpublished entry.';
360+
$this->addContent('1.6.2', $changes);
361+
}
354362

355363
private function addContent($version, array $changes)
356364
{

class/Controller/Entry/Admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function deleteCommand(Request $request)
8484
protected function viewJsonCommand(Request $request)
8585
{
8686
$entry = $this->factory->load($this->id);
87-
return array('entry' => $this->factory->data($entry));
87+
return array('entry' => $entry->getStringVars(true));
8888
}
8989

9090
protected function viewHtmlCommand(Request $request)

class/Factory/EntryFactory.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -639,14 +639,6 @@ public function shareData(Resource $entry)
639639
['authorEmail', 'authorId', 'content', 'deleted', 'expirationDate', 'updateDate', 'createDateRelative', 'createDate', 'published']);
640640
}
641641

642-
public function data(Resource $entry, $publishOnly = true)
643-
{
644-
if ($publishOnly && (!$entry->published && $entry->publishDate < time())) {
645-
return null;
646-
}
647-
return $entry->getStringVars(true);
648-
}
649-
650642
/**
651643
* Flips the deleted flag on the entry. Tags are not touched as the
652644
* entry will not be pulled. Features will be purged however.

class/View/EntryView.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function form(Resource $entry, $new = false)
7373
$tagFactory = new TagFactory();
7474

7575
$sourceHttp = PHPWS_SOURCE_HTTP;
76-
$status = $new ? 'Draft' : 'Last updated ' . $entry->relativeTime($entry->updateDate);
76+
$status = $new || empty($entry->updateDate) ? 'Draft' : 'Last updated ' . $entry->relativeTime($entry->updateDate);
7777
$entryVars = $entry->getStringVars();
7878
$entryVars['content'] = $this->prepareFormContent($entryVars['content']);
7979
$tags = $tagFactory->listTags(true);
@@ -132,7 +132,6 @@ private function includeCards(Resource $entry)
132132
\Layout::addJSHeader($this->includeTwitterCards($entry));
133133
}
134134

135-
136135
/**
137136
* Medium editor insert doesn't initialize the Twitter embed. Has to be done
138137
* manually. The editor includes a script call to widgets BUT that is stripped
@@ -196,10 +195,10 @@ public function inListView($id)
196195

197196
\Layout::addJSHeader($this->mediumCSSOverride());
198197
$entry = $this->factory->load($id);
199-
$data = $this->factory->data($entry, !$this->isAdmin);
200-
if (empty($data)) {
201-
throw new ResourceNotFound($id);
198+
if (!$this->isAdmin && (!$entry->published && $entry->publishDate < time())) {
199+
return null;
202200
}
201+
$data = $entry->getStringVars(true);
203202
$this->includeCards($entry);
204203

205204
if ($entry->listView == 1) {
@@ -216,7 +215,7 @@ public function inListView($id)
216215
} else {
217216
$data['summaryAnchor'] = '';
218217
}
219-
218+
220219
$templateFile = 'Entry/SummaryListView.html';
221220
}
222221
// Removed the summary break tag
@@ -248,10 +247,10 @@ public function view($id)
248247
try {
249248
$this->includeCss();
250249
$entry = $this->factory->load($id);
251-
$data = $this->factory->data($entry, !$this->isAdmin);
252-
if (empty($data)) {
253-
throw new ResourceNotFound;
250+
if (!$this->isAdmin && (!$entry->published && $entry->publishDate < time())) {
251+
return null;
254252
}
253+
$data = $entry->getStringVars(true);
255254
$this->includeCards($entry);
256255
if (stristr($entry->content, 'twitter')) {
257256
$this->loadTwitterScript(true);

0 commit comments

Comments
 (0)