[TwitterBridge] Add option to hide pinned tweet (#1908)

This commit is contained in:
FiveFilters.org 2021-01-10 09:50:06 +01:00 committed by GitHub
parent e128ce807a
commit f927781750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 0 deletions

View File

@ -75,6 +75,12 @@ EOD
'required' => false,
'type' => 'checkbox',
'title' => 'Hide retweets'
),
'nopinned' => array(
'name' => 'Without pinned tweet',
'required' => false,
'type' => 'checkbox',
'title' => 'Hide pinned tweet'
)
),
'By list' => array(
@ -246,6 +252,14 @@ EOD
return $carry;
}, array());
$hidePinned = $this->getInput('nopinned');
if ($hidePinned) {
$pinnedTweetId = null;
if (isset($data->timeline->instructions[1]) && isset($data->timeline->instructions[1]->pinEntry)) {
$pinnedTweetId = $data->timeline->instructions[1]->pinEntry->entry->content->item->content->tweet->id;
}
}
foreach($data->globalObjects->tweets as $tweet) {
/* Debug::log('>>> ' . json_encode($tweet)); */
@ -259,6 +273,11 @@ EOD
continue;
}
// Skip pinned tweet
if ($hidePinned && $tweet->id_str === $pinnedTweetId) {
continue;
}
$item = array();
// extract username and sanitize
$user_info = $this->getUserInformation($tweet->user_id_str, $data->globalObjects);