Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🀍

Feature/change twitter to x (#2654)

Thomas Kaul1586cd3a5963
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9dd09672b1..576737e0b2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Improved the data source validation in the activities import
+- Changed _Twitter_ to _𝕏_
+- Improved selection in the twitter bot service
- Improved the language localization for German (`de`)
- Upgraded `ng-extract-i18n-merge` from version `2.7.0` to `2.8.3`
- Upgraded `prettier` from version `3.0.3` to `3.1.0`
diff --git a/apps/api/src/app/benchmark/benchmark.service.ts b/apps/api/src/app/benchmark/benchmark.service.ts
index 1f143fa2e4..93f4ecc9be 100644
--- a/apps/api/src/app/benchmark/benchmark.service.ts
+++ b/apps/api/src/app/benchmark/benchmark.service.ts
@@ -73,9 +73,10 @@ export class BenchmarkService {
return { trend50d: fiftyDayAverage, trend200d: twoHundredDayAverage };
}
- public async getBenchmarks({ useCache = true } = {}): Promise<
- BenchmarkResponse['benchmarks']
- > {
+ public async getBenchmarks({
+ enableSharing = false,
+ useCache = true
+ } = {}): Promise<BenchmarkResponse['benchmarks']> {
let benchmarks: BenchmarkResponse['benchmarks'];
if (useCache) {
@@ -90,7 +91,9 @@ export class BenchmarkService {
} catch {}
}
- const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles();
+ const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles({
+ enableSharing
+ });
const promisesAllTimeHighs: Promise<{ date: Date; marketPrice: number }>[] =
[];
@@ -162,14 +165,24 @@ export class BenchmarkService {
return benchmarks;
}
- public async getBenchmarkAssetProfiles(): Promise<Partial<SymbolProfile>[]> {
+ public async getBenchmarkAssetProfiles({
+ enableSharing = false
+ } = {}): Promise<Partial<SymbolProfile>[]> {
const symbolProfileIds: string[] = (
((await this.propertyService.getByKey(
PROPERTY_BENCHMARKS
)) as BenchmarkProperty[]) ?? []
- ).map(({ symbolProfileId }) => {
- return symbolProfileId;
- });
+ )
+ .filter((benchmark) => {
+ if (enableSharing) {
+ return benchmark.enableSharing;
+ }
+
+ return true;
+ })
+ .map(({ symbolProfileId }) => {
+ return symbolProfileId;
+ });
const assetProfiles =
await this.symbolProfileService.getSymbolProfilesByIds(symbolProfileIds);
diff --git a/apps/api/src/services/twitter-bot/twitter-bot.service.ts b/apps/api/src/services/twitter-bot/twitter-bot.service.ts
index d3e7fb91c4..02a11b74fa 100644
--- a/apps/api/src/services/twitter-bot/twitter-bot.service.ts
+++ b/apps/api/src/services/twitter-bot/twitter-bot.service.ts
@@ -57,7 +57,7 @@ export class TwitterBotService {
symbolItem.marketPrice
}/100)`;
- const benchmarkListing = await this.getBenchmarkListing(3);
+ const benchmarkListing = await this.getBenchmarkListing();
if (benchmarkListing?.length > 1) {
status += '\n\n';
@@ -78,29 +78,22 @@ export class TwitterBotService {
}
}
- private async getBenchmarkListing(aMax: number) {
+ private async getBenchmarkListing() {
const benchmarks = await this.benchmarkService.getBenchmarks({
+ enableSharing: true,
useCache: false
});
- const benchmarkListing: string[] = [];
-
- for (const [index, benchmark] of benchmarks.entries()) {
- if (index > aMax - 1) {
- break;
- }
-
- benchmarkListing.push(
- `${benchmark.name} ${(
- benchmark.performances.allTimeHigh.performancePercent * 100
+ return benchmarks
+ .map(({ marketCondition, name, performances }) => {
+ return `${name} ${(
+ performances.allTimeHigh.performancePercent * 100
).toFixed(1)}%${
- benchmark.marketCondition !== 'NEUTRAL_MARKET'
- ? ' ' + resolveMarketCondition(benchmark.marketCondition).emoji
+ marketCondition !== 'NEUTRAL_MARKET'
+ ? ' ' + resolveMarketCondition(marketCondition).emoji
: ''
- }`
- );
- }
-
- return benchmarkListing.join('\n');
+ }`;
+ })
+ .join('\n');
}
}
diff --git a/apps/client/src/app/app.component.html b/apps/client/src/app/app.component.html
index 31281fe48a..415770760a 100644
--- a/apps/client/src/app/app.component.html
+++ b/apps/client/src/app/app.component.html
@@ -127,8 +127,11 @@
class="align-items-baseline d-flex"
href="https://twitter.com/ghostfolio_"
target="_blank"
- title="Follow Ghostfolio on Twitter"
- >Twitter<ion-icon class="ml-1" name="open-outline"></ion-icon
+ title="Follow Ghostfolio on X (formerly Twitter)"
+ >X (formerly Twitter)<ion-icon
+ class="ml-1"
+ name="open-outline"
+ ></ion-icon
></a>
</li>
<li>&nbsp;</li>
diff --git a/apps/client/src/app/pages/about/overview/about-overview-page.html b/apps/client/src/app/pages/about/overview/about-overview-page.html
index 4dc9fbf780..02cbf7de5a 100644
--- a/apps/client/src/app/pages/about/overview/about-overview-page.html
+++ b/apps/client/src/app/pages/about/overview/about-overview-page.html
@@ -55,7 +55,7 @@
community, tweet to
<a
href="https://twitter.com/ghostfolio_"
- title="Tweet to Ghostfolio on Twitter"
+ title="Post to Ghostfolio on X (formerly Twitter)"
>@ghostfolio_</a
><ng-container *ngIf="user?.subscription?.type === 'Premium'"
>, send an e-mail to
@@ -70,14 +70,14 @@
>GitHub</a
>.
</p>
- <p class="text-center">
+ <p class="align-items-center d-flex justify-content-center">
<a
class="mx-2"
href="https://twitter.com/ghostfolio_"
mat-icon-button
- title="Follow Ghostfolio on Twitter"
+ title="Follow Ghostfolio on X (formerly Twitter)"
>
- <ion-icon name="logo-twitter"></ion-icon>
+ <span class="line-height-1 text-center w-100">𝕏</span>
</a>
<a
*ngIf="user?.subscription?.type === 'Premium'"
diff --git a/apps/client/src/app/pages/faq/faq-page.html b/apps/client/src/app/pages/faq/faq-page.html
index 8973e700e6..e6e23e4b96 100644
--- a/apps/client/src/app/pages/faq/faq-page.html
+++ b/apps/client/src/app/pages/faq/faq-page.html
@@ -233,7 +233,7 @@
community,
<a
href="https://twitter.com/ghostfolio_"
- title="Tweet to Ghostfolio on Twitter"
+ title="Post to Ghostfolio on X (formerly Twitter)"
>@ghostfolio_</a
><ng-container *ngIf="user?.subscription?.type === 'Premium'"
>,
@@ -262,7 +262,7 @@
>community, tweet to
<a
href="https://twitter.com/ghostfolio_"
- title="Tweet to Ghostfolio on Twitter"
+ title="Post to Ghostfolio on X (formerly Twitter)"
>@ghostfolio_</a
><ng-container *ngIf="user?.subscription?.type === 'Premium'"
>, send an e-mail to
diff --git a/libs/common/src/lib/interfaces/benchmark-property.interface.ts b/libs/common/src/lib/interfaces/benchmark-property.interface.ts
index bccf4ed78f..a6c4958ed3 100644
--- a/libs/common/src/lib/interfaces/benchmark-property.interface.ts
+++ b/libs/common/src/lib/interfaces/benchmark-property.interface.ts
@@ -1,3 +1,4 @@
export interface BenchmarkProperty {
+ enableSharing?: boolean;
symbolProfileId: string;
}