mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-01 03:35:49 -04:00
Option to show user labels instead of tags in RSS share (#8112)
* Option to show user labels instead of tags in RSS share fix https://github.com/FreshRSS/FreshRSS/discussions/8108#discussioncomment-14668813 <img width="711" height="182" alt="image" src="https://github.com/user-attachments/assets/8effb2cd-fffb-4f00-b628-54e963e8b2dc" />
This commit is contained in:
committed by
GitHub
parent
faaa770bc0
commit
b7bd18148e
@@ -21,6 +21,7 @@ class FreshRSS_UserQuery {
|
||||
private string $token = '';
|
||||
private bool $shareRss = false;
|
||||
private bool $shareOpml = false;
|
||||
private bool $publishLabelsInsteadOfTags = false;
|
||||
/** @var array<int,FreshRSS_Category> $categories where the key is the category ID */
|
||||
private array $categories;
|
||||
/** @var array<int,FreshRSS_Tag> $labels where the key is the label ID */
|
||||
@@ -43,7 +44,7 @@ class FreshRSS_UserQuery {
|
||||
|
||||
/**
|
||||
* @param array{get?:string,name?:string,order?:string,search?:string,state?:int,url?:string,token?:string,
|
||||
* shareRss?:bool,shareOpml?:bool,description?:string,imageUrl?:string} $query
|
||||
* shareRss?:bool,shareOpml?:bool,publishLabelsInsteadOfTags?:bool,description?:string,imageUrl?:string} $query
|
||||
* @param array<FreshRSS_Category> $categories
|
||||
* @param array<FreshRSS_Tag> $labels
|
||||
*/
|
||||
@@ -75,6 +76,7 @@ class FreshRSS_UserQuery {
|
||||
unset($link['name']);
|
||||
unset($link['shareOpml']);
|
||||
unset($link['shareRss']);
|
||||
unset($link['publishLabelsInsteadOfTags']);
|
||||
$this->url = Minz_Url::display(['params' => $link]);
|
||||
}
|
||||
} else {
|
||||
@@ -92,6 +94,9 @@ class FreshRSS_UserQuery {
|
||||
if (isset($query['shareOpml'])) {
|
||||
$this->shareOpml = $query['shareOpml'];
|
||||
}
|
||||
if (isset($query['publishLabelsInsteadOfTags'])) {
|
||||
$this->publishLabelsInsteadOfTags = (bool)$query['publishLabelsInsteadOfTags'];
|
||||
}
|
||||
if (isset($query['description'])) {
|
||||
$this->description = $query['description'];
|
||||
}
|
||||
@@ -109,7 +114,9 @@ class FreshRSS_UserQuery {
|
||||
/**
|
||||
* Convert the current object to an array.
|
||||
*
|
||||
* @return array{'get'?:string,'name'?:string,'order'?:string,'search'?:string,'state'?:int,'url'?:string,'token'?:string}
|
||||
* @return array{get?:string,name?:string,order?:string,search?:string,
|
||||
* state?:int,url?:string,token?:string,shareRss?:bool,shareOpml?:bool,
|
||||
* publishLabelsInsteadOfTags?:bool,description?:string,imageUrl?:string}
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return array_filter([
|
||||
@@ -122,6 +129,7 @@ class FreshRSS_UserQuery {
|
||||
'token' => $this->token,
|
||||
'shareRss' => $this->shareRss,
|
||||
'shareOpml' => $this->shareOpml,
|
||||
'publishLabelsInsteadOfTags' => $this->publishLabelsInsteadOfTags,
|
||||
'description' => $this->description,
|
||||
'imageUrl' => $this->imageUrl,
|
||||
], fn($v): bool => $v !== '' && $v !== 0 && $v !== false);
|
||||
@@ -279,6 +287,14 @@ class FreshRSS_UserQuery {
|
||||
return $this->shareOpml;
|
||||
}
|
||||
|
||||
public function setPublishLabelsInsteadOfTags(bool $publishLabelsInsteadOfTags): void {
|
||||
$this->publishLabelsInsteadOfTags = $publishLabelsInsteadOfTags;
|
||||
}
|
||||
|
||||
public function publishLabelsInsteadOfTags(): bool {
|
||||
return $this->publishLabelsInsteadOfTags;
|
||||
}
|
||||
|
||||
protected function sharedUrl(bool $xmlEscaped = true): string {
|
||||
$currentUser = Minz_User::name() ?? '';
|
||||
return Minz_Url::display("/api/query.php?user={$currentUser}&t={$this->token}", $xmlEscaped ? 'html' : '', true);
|
||||
|
||||
Reference in New Issue
Block a user