Merge remote-tracking branch 'parent/main' into upstream-20241107
This commit is contained in:
commit
a003c2db89
98 changed files with 2002 additions and 590 deletions
44
app/javascript/mastodon/models/annual_report.ts
Normal file
44
app/javascript/mastodon/models/annual_report.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
export interface Percentiles {
|
||||
followers: number;
|
||||
statuses: number;
|
||||
}
|
||||
|
||||
export interface NameAndCount {
|
||||
name: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface TimeSeriesMonth {
|
||||
month: number;
|
||||
statuses: number;
|
||||
following: number;
|
||||
followers: number;
|
||||
}
|
||||
|
||||
export interface TopStatuses {
|
||||
by_reblogs: number;
|
||||
by_favourites: number;
|
||||
by_replies: number;
|
||||
}
|
||||
|
||||
export type Archetype =
|
||||
| 'lurker'
|
||||
| 'booster'
|
||||
| 'pollster'
|
||||
| 'replier'
|
||||
| 'oracle';
|
||||
|
||||
interface AnnualReportV1 {
|
||||
most_used_apps: NameAndCount[];
|
||||
percentiles: Percentiles;
|
||||
top_hashtags: NameAndCount[];
|
||||
top_statuses: TopStatuses;
|
||||
time_series: TimeSeriesMonth[];
|
||||
archetype: Archetype;
|
||||
}
|
||||
|
||||
export interface AnnualReport {
|
||||
year: number;
|
||||
schema_version: number;
|
||||
data: AnnualReportV1;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import type {
|
||||
ApiAccountRelationshipSeveranceEventJSON,
|
||||
ApiAccountWarningJSON,
|
||||
ApiAnnualReportEventJSON,
|
||||
BaseNotificationGroupJSON,
|
||||
ApiNotificationGroupJSON,
|
||||
ApiNotificationJSON,
|
||||
|
@ -91,6 +92,12 @@ export interface NotificationGroupSeveredRelationships
|
|||
event: AccountRelationshipSeveranceEvent;
|
||||
}
|
||||
|
||||
type AnnualReportEvent = ApiAnnualReportEventJSON;
|
||||
export interface NotificationGroupAnnualReport
|
||||
extends BaseNotification<'annual_report'> {
|
||||
annualReport: AnnualReportEvent;
|
||||
}
|
||||
|
||||
interface Report extends Omit<ApiReportJSON, 'target_account'> {
|
||||
targetAccountId: string;
|
||||
}
|
||||
|
@ -115,7 +122,8 @@ export type NotificationGroup =
|
|||
| NotificationGroupModerationWarning
|
||||
| NotificationGroupSeveredRelationships
|
||||
| NotificationGroupAdminSignUp
|
||||
| NotificationGroupAdminReport;
|
||||
| NotificationGroupAdminReport
|
||||
| NotificationGroupAnnualReport;
|
||||
|
||||
function createReportFromJSON(reportJSON: ApiReportJSON): Report {
|
||||
const { target_account, ...report } = reportJSON;
|
||||
|
@ -155,6 +163,12 @@ function createEmojiReactionGroupsFromJSON(
|
|||
];
|
||||
}
|
||||
|
||||
function createAnnualReportEventFromJSON(
|
||||
eventJson: ApiAnnualReportEventJSON,
|
||||
): AnnualReportEvent {
|
||||
return eventJson;
|
||||
}
|
||||
|
||||
export function createNotificationGroupFromJSON(
|
||||
groupJson: ApiNotificationGroupJSON,
|
||||
): NotificationGroup {
|
||||
|
@ -213,7 +227,6 @@ export function createNotificationGroupFromJSON(
|
|||
event: createAccountRelationshipSeveranceEventFromJSON(group.event),
|
||||
sampleAccountIds,
|
||||
};
|
||||
|
||||
case 'moderation_warning': {
|
||||
const { moderation_warning, ...groupWithoutModerationWarning } = group;
|
||||
return {
|
||||
|
@ -222,6 +235,14 @@ export function createNotificationGroupFromJSON(
|
|||
sampleAccountIds,
|
||||
};
|
||||
}
|
||||
case 'annual_report': {
|
||||
const { annual_report, ...groupWithoutAnnualReport } = group;
|
||||
return {
|
||||
...groupWithoutAnnualReport,
|
||||
annualReport: createAnnualReportEventFromJSON(annual_report),
|
||||
sampleAccountIds,
|
||||
};
|
||||
}
|
||||
default:
|
||||
return {
|
||||
sampleAccountIds,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue