Optimistic statuses: prepend with 末 to sort it at the end

merge-requests/692/merge
Alex Gleason 2021-10-09 21:16:37 -05:00
rodzic 135b4c4d7b
commit 379d03a509
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
5 zmienionych plików z 9 dodań i 9 usunięć

Wyświetl plik

@ -124,7 +124,7 @@ export default class StatusList extends ImmutablePureComponent {
renderPendingStatus(statusId) {
const { timelineId, withGroupAdmin, group } = this.props;
const idempotencyKey = statusId.replace(/^pending-/, '');
const idempotencyKey = statusId.replace(/^pending-/, '');
return (
<div className='material-status' key={statusId}>
@ -168,7 +168,7 @@ export default class StatusList extends ImmutablePureComponent {
return statusIds.map((statusId, index) => {
if (statusId === null) {
return this.renderLoadGap(index);
} else if (statusId.startsWith('pending-')) {
} else if (statusId.startsWith('pending-')) {
return this.renderPendingStatus(statusId);
} else {
return this.renderStatus(statusId);

Wyświetl plik

@ -487,7 +487,7 @@ class Status extends ImmutablePureComponent {
}
renderPendingStatus(id) {
const idempotencyKey = id.replace(/^pending-/, '');
const idempotencyKey = id.replace(/^pending-/, '');
return (
<PendingStatus
@ -505,7 +505,7 @@ class Status extends ImmutablePureComponent {
return list.map(id => {
if (id.endsWith('-tombstone')) {
return this.renderTombstone(id);
} else if (id.startsWith('pending-')) {
} else if (id.startsWith('pending-')) {
return this.renderPendingStatus(id);
} else {
return this.renderStatus(id);

Wyświetl plik

@ -18,7 +18,7 @@ export const buildStatus = (state, pendingStatus, idempotencyKey) => {
emojis: [],
favourited: false,
favourites_count: 0,
id: `pending-${idempotencyKey}`,
id: `pending-${idempotencyKey}`,
in_reply_to_account_id: null,
in_reply_to_id: pendingStatus.get('in_reply_to_id'),
language: null,

Wyświetl plik

@ -101,13 +101,13 @@ const filterContexts = (state, relationship, statuses) => {
};
const importPendingStatus = (state, params, idempotencyKey) => {
const id = `pending-${idempotencyKey}`;
const id = `pending-${idempotencyKey}`;
const { in_reply_to_id } = params;
return importStatus(state, { id, in_reply_to_id });
};
const deletePendingStatus = (state, { in_reply_to_id }, idempotencyKey) => {
const id = `pending-${idempotencyKey}`;
const id = `pending-${idempotencyKey}`;
return state.withMutations(state => {
state.deleteIn(['inReplyTos', id]);

Wyświetl plik

@ -256,7 +256,7 @@ const replaceItem = (state, timelineId, oldId, newId) => {
};
const importPendingStatus = (state, params, idempotencyKey) => {
const statusId = `pending-${idempotencyKey}`;
const statusId = `pending-${idempotencyKey}`;
return state.withMutations(state => {
const timelineIds = getTimelinesByVisibility(params.visibility);
@ -268,7 +268,7 @@ const importPendingStatus = (state, params, idempotencyKey) => {
};
const replacePendingStatus = (state, idempotencyKey, newId) => {
const oldId = `pending-${idempotencyKey}`;
const oldId = `pending-${idempotencyKey}`;
state.keySeq().forEach(timelineId => {
return replaceItem(state, timelineId, oldId, newId);