Pārlūkot izejas kodu

Add full content delimiter and action (#3463)

Before, when appending or prepending the content of the CSS selector
content, it was added to the content. It was working fine for the
first call but every subsequent calls were pilling the retrieved
content on top of the already retrieved content. Thus we had an ever
growing content with a lot of duplication.
Now, the CSS selector content is identified by an HTML comment which
is used to remove the content for every subsequent calls.

The bug was introduced in #3453
Alexis Degrugillier 5 gadi atpakaļ
vecāks
revīzija
9682fcfebb
1 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 4 2
      app/Models/Entry.php

+ 4 - 2
app/Models/Entry.php

@@ -447,12 +447,14 @@ class FreshRSS_Entry extends Minz_Model {
 						$feed->attributes()
 					);
 					if ('' !== $fullContent) {
+						$fullContent = "<!-- FULLCONTENT start //-->{$fullContent}<!-- FULLCONTENT end //-->";
+						$originalContent = preg_replace('#<!-- FULLCONTENT start //-->.*<!-- FULLCONTENT end //-->#s', '', $this->content());
 						switch ($feed->attributes('content_action')) {
 							case 'prepend':
-								$this->content = $fullContent . $this->content();
+								$this->content = $fullContent . $originalContent;
 								break;
 							case 'append':
-								$this->content = $this->content() . $fullContent;
+								$this->content = $originalContent . $fullContent;
 								break;
 							case 'replace':
 							default: