kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Optimistic statuses: prepend with 末 to sort it at the end
rodzic
135b4c4d7b
commit
379d03a509
|
@ -124,7 +124,7 @@ export default class StatusList extends ImmutablePureComponent {
|
||||||
|
|
||||||
renderPendingStatus(statusId) {
|
renderPendingStatus(statusId) {
|
||||||
const { timelineId, withGroupAdmin, group } = this.props;
|
const { timelineId, withGroupAdmin, group } = this.props;
|
||||||
const idempotencyKey = statusId.replace(/^pending-/, '');
|
const idempotencyKey = statusId.replace(/^末pending-/, '');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='material-status' key={statusId}>
|
<div className='material-status' key={statusId}>
|
||||||
|
@ -168,7 +168,7 @@ export default class StatusList extends ImmutablePureComponent {
|
||||||
return statusIds.map((statusId, index) => {
|
return statusIds.map((statusId, index) => {
|
||||||
if (statusId === null) {
|
if (statusId === null) {
|
||||||
return this.renderLoadGap(index);
|
return this.renderLoadGap(index);
|
||||||
} else if (statusId.startsWith('pending-')) {
|
} else if (statusId.startsWith('末pending-')) {
|
||||||
return this.renderPendingStatus(statusId);
|
return this.renderPendingStatus(statusId);
|
||||||
} else {
|
} else {
|
||||||
return this.renderStatus(statusId);
|
return this.renderStatus(statusId);
|
||||||
|
|
|
@ -487,7 +487,7 @@ class Status extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderPendingStatus(id) {
|
renderPendingStatus(id) {
|
||||||
const idempotencyKey = id.replace(/^pending-/, '');
|
const idempotencyKey = id.replace(/^末pending-/, '');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PendingStatus
|
<PendingStatus
|
||||||
|
@ -505,7 +505,7 @@ class Status extends ImmutablePureComponent {
|
||||||
return list.map(id => {
|
return list.map(id => {
|
||||||
if (id.endsWith('-tombstone')) {
|
if (id.endsWith('-tombstone')) {
|
||||||
return this.renderTombstone(id);
|
return this.renderTombstone(id);
|
||||||
} else if (id.startsWith('pending-')) {
|
} else if (id.startsWith('末pending-')) {
|
||||||
return this.renderPendingStatus(id);
|
return this.renderPendingStatus(id);
|
||||||
} else {
|
} else {
|
||||||
return this.renderStatus(id);
|
return this.renderStatus(id);
|
||||||
|
|
|
@ -18,7 +18,7 @@ export const buildStatus = (state, pendingStatus, idempotencyKey) => {
|
||||||
emojis: [],
|
emojis: [],
|
||||||
favourited: false,
|
favourited: false,
|
||||||
favourites_count: 0,
|
favourites_count: 0,
|
||||||
id: `pending-${idempotencyKey}`,
|
id: `末pending-${idempotencyKey}`,
|
||||||
in_reply_to_account_id: null,
|
in_reply_to_account_id: null,
|
||||||
in_reply_to_id: pendingStatus.get('in_reply_to_id'),
|
in_reply_to_id: pendingStatus.get('in_reply_to_id'),
|
||||||
language: null,
|
language: null,
|
||||||
|
|
|
@ -101,13 +101,13 @@ const filterContexts = (state, relationship, statuses) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const importPendingStatus = (state, params, idempotencyKey) => {
|
const importPendingStatus = (state, params, idempotencyKey) => {
|
||||||
const id = `pending-${idempotencyKey}`;
|
const id = `末pending-${idempotencyKey}`;
|
||||||
const { in_reply_to_id } = params;
|
const { in_reply_to_id } = params;
|
||||||
return importStatus(state, { id, in_reply_to_id });
|
return importStatus(state, { id, in_reply_to_id });
|
||||||
};
|
};
|
||||||
|
|
||||||
const deletePendingStatus = (state, { in_reply_to_id }, idempotencyKey) => {
|
const deletePendingStatus = (state, { in_reply_to_id }, idempotencyKey) => {
|
||||||
const id = `pending-${idempotencyKey}`;
|
const id = `末pending-${idempotencyKey}`;
|
||||||
|
|
||||||
return state.withMutations(state => {
|
return state.withMutations(state => {
|
||||||
state.deleteIn(['inReplyTos', id]);
|
state.deleteIn(['inReplyTos', id]);
|
||||||
|
|
|
@ -256,7 +256,7 @@ const replaceItem = (state, timelineId, oldId, newId) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const importPendingStatus = (state, params, idempotencyKey) => {
|
const importPendingStatus = (state, params, idempotencyKey) => {
|
||||||
const statusId = `pending-${idempotencyKey}`;
|
const statusId = `末pending-${idempotencyKey}`;
|
||||||
|
|
||||||
return state.withMutations(state => {
|
return state.withMutations(state => {
|
||||||
const timelineIds = getTimelinesByVisibility(params.visibility);
|
const timelineIds = getTimelinesByVisibility(params.visibility);
|
||||||
|
@ -268,7 +268,7 @@ const importPendingStatus = (state, params, idempotencyKey) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const replacePendingStatus = (state, idempotencyKey, newId) => {
|
const replacePendingStatus = (state, idempotencyKey, newId) => {
|
||||||
const oldId = `pending-${idempotencyKey}`;
|
const oldId = `末pending-${idempotencyKey}`;
|
||||||
|
|
||||||
state.keySeq().forEach(timelineId => {
|
state.keySeq().forEach(timelineId => {
|
||||||
return replaceItem(state, timelineId, oldId, newId);
|
return replaceItem(state, timelineId, oldId, newId);
|
||||||
|
|
Ładowanie…
Reference in New Issue