[TwitterBridge] Add option to hide pinned tweet (#1908)
This commit is contained in:
parent
e128ce807a
commit
f927781750
1 changed files with 19 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue