sforkowany z mirror/soapbox
Normalizers: add jsdoc heading
rodzic
2089cb124d
commit
b100068b95
|
@ -1,3 +1,8 @@
|
||||||
|
/**
|
||||||
|
* Account normalizer:
|
||||||
|
* Converts API accounts into our internal format.
|
||||||
|
* @see {@link https://docs.joinmastodon.org/entities/account/}
|
||||||
|
*/
|
||||||
import escapeTextContentForBrowser from 'escape-html';
|
import escapeTextContentForBrowser from 'escape-html';
|
||||||
import {
|
import {
|
||||||
Map as ImmutableMap,
|
Map as ImmutableMap,
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/**
|
||||||
|
* Emoji normalizer:
|
||||||
|
* Converts API emojis into our internal format.
|
||||||
|
* @see {@link https://docs.joinmastodon.org/entities/emoji/}
|
||||||
|
*/
|
||||||
import { Record as ImmutableRecord, Map as ImmutableMap } from 'immutable';
|
import { Record as ImmutableRecord, Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/emoji/
|
// https://docs.joinmastodon.org/entities/emoji/
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/**
|
||||||
|
* Instance normalizer:
|
||||||
|
* Converts API instances into our internal format.
|
||||||
|
* @see {@link https://docs.joinmastodon.org/entities/instance/}
|
||||||
|
*/
|
||||||
import {
|
import {
|
||||||
Map as ImmutableMap,
|
Map as ImmutableMap,
|
||||||
List as ImmutableList,
|
List as ImmutableList,
|
||||||
|
@ -9,6 +14,7 @@ import { mergeDefined } from 'soapbox/utils/normalizers';
|
||||||
import { isNumber } from 'soapbox/utils/numbers';
|
import { isNumber } from 'soapbox/utils/numbers';
|
||||||
|
|
||||||
// Use Mastodon defaults
|
// Use Mastodon defaults
|
||||||
|
// https://docs.joinmastodon.org/entities/instance/
|
||||||
const InstanceRecord = ImmutableRecord({
|
const InstanceRecord = ImmutableRecord({
|
||||||
approval_required: false,
|
approval_required: false,
|
||||||
contact_account: ImmutableMap(),
|
contact_account: ImmutableMap(),
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/**
|
||||||
|
* Notification normalizer:
|
||||||
|
* Converts API notifications into our internal format.
|
||||||
|
* @see {@link https://docs.joinmastodon.org/entities/notification/}
|
||||||
|
*/
|
||||||
import {
|
import {
|
||||||
Map as ImmutableMap,
|
Map as ImmutableMap,
|
||||||
Record as ImmutableRecord,
|
Record as ImmutableRecord,
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/**
|
||||||
|
* Status normalizer:
|
||||||
|
* Converts API statuses into our internal format.
|
||||||
|
* @see {@link https://docs.joinmastodon.org/entities/status/}
|
||||||
|
*/
|
||||||
import escapeTextContentForBrowser from 'escape-html';
|
import escapeTextContentForBrowser from 'escape-html';
|
||||||
import {
|
import {
|
||||||
Map as ImmutableMap,
|
Map as ImmutableMap,
|
||||||
|
@ -11,6 +16,7 @@ import { normalizeEmoji } from 'soapbox/normalizers/emoji';
|
||||||
import { IStatus } from 'soapbox/types';
|
import { IStatus } from 'soapbox/types';
|
||||||
import { mergeDefined, makeEmojiMap } from 'soapbox/utils/normalizers';
|
import { mergeDefined, makeEmojiMap } from 'soapbox/utils/normalizers';
|
||||||
|
|
||||||
|
// https://docs.joinmastodon.org/entities/status/
|
||||||
const StatusRecord = ImmutableRecord({
|
const StatusRecord = ImmutableRecord({
|
||||||
account: null,
|
account: null,
|
||||||
application: null,
|
application: null,
|
||||||
|
@ -99,7 +105,6 @@ const PollOptionRecord = ImmutableRecord({
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ensure attachments have required fields
|
// Ensure attachments have required fields
|
||||||
// https://docs.joinmastodon.org/entities/attachment/
|
|
||||||
const normalizeAttachment = (attachment: ImmutableMap<string, any>) => {
|
const normalizeAttachment = (attachment: ImmutableMap<string, any>) => {
|
||||||
const url = [
|
const url = [
|
||||||
attachment.get('url'),
|
attachment.get('url'),
|
||||||
|
|
Ładowanie…
Reference in New Issue