Merge remote-tracking branch 'parent/main' into upstream-20231107
This commit is contained in:
commit
64578feeb4
69 changed files with 437 additions and 218 deletions
|
@ -41,32 +41,34 @@ const normalizeAccounts = (
|
|||
return state;
|
||||
};
|
||||
|
||||
export const accountsReducer: Reducer<typeof initialState> = (
|
||||
state = initialState,
|
||||
action,
|
||||
) => {
|
||||
const currentUserId = me;
|
||||
|
||||
if (!currentUserId)
|
||||
function getCurrentUser() {
|
||||
if (!me)
|
||||
throw new Error(
|
||||
'No current user (me) defined when calling `accountsReducer`',
|
||||
);
|
||||
|
||||
return me;
|
||||
}
|
||||
|
||||
export const accountsReducer: Reducer<typeof initialState> = (
|
||||
state = initialState,
|
||||
action,
|
||||
) => {
|
||||
if (revealAccount.match(action))
|
||||
return state.setIn([action.payload.id, 'hidden'], false);
|
||||
else if (importAccounts.match(action))
|
||||
return normalizeAccounts(state, action.payload.accounts);
|
||||
else if (followAccountSuccess.match(action))
|
||||
else if (followAccountSuccess.match(action)) {
|
||||
return state
|
||||
.update(
|
||||
action.payload.relationship.id,
|
||||
(account) => account?.update('followers_count', (n) => n + 1),
|
||||
)
|
||||
.update(
|
||||
currentUserId,
|
||||
getCurrentUser(),
|
||||
(account) => account?.update('following_count', (n) => n + 1),
|
||||
);
|
||||
else if (unfollowAccountSuccess.match(action))
|
||||
} else if (unfollowAccountSuccess.match(action))
|
||||
return state
|
||||
.update(
|
||||
action.payload.relationship.id,
|
||||
|
@ -74,7 +76,7 @@ export const accountsReducer: Reducer<typeof initialState> = (
|
|||
account?.update('followers_count', (n) => Math.max(0, n - 1)),
|
||||
)
|
||||
.update(
|
||||
currentUserId,
|
||||
getCurrentUser(),
|
||||
(account) =>
|
||||
account?.update('following_count', (n) => Math.max(0, n - 1)),
|
||||
);
|
||||
|
|
|
@ -1886,12 +1886,14 @@ a.account__display-name {
|
|||
&.activate {
|
||||
& > .icon {
|
||||
animation: spring-rotate-in 1s linear;
|
||||
transform-origin: 50% 55%;
|
||||
}
|
||||
}
|
||||
|
||||
&.deactivate {
|
||||
& > .icon {
|
||||
animation: spring-rotate-out 1s linear;
|
||||
transform-origin: 50% 55%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue