mirror of
https://github.com/wassname/talk.git
synced 2026-08-11 11:27:10 +08:00
[CORL-649] Migrations (#2597)
* feat: added migration framework * chore: added premod user status migration * feat: enhanced error handling of migrations * fix: added missing argument from abstract method * fix: another templating blunder * fix: removed debug code * feat: enhanced migration tracking * fix: remove skipping migrations * feat: moved indexing to migration system * fix: linting
This commit is contained in:
@@ -107,20 +107,17 @@ const UserDrawerAccountHistory: FunctionComponent<Props> = ({ user }) => {
|
||||
});
|
||||
});
|
||||
|
||||
// FIXME: (wyattjoh) once migration has been performed, remove check
|
||||
if (user.status.premod) {
|
||||
// Merge in all the premod history items.
|
||||
user.status.premod.history.forEach(record => {
|
||||
history.push({
|
||||
kind: "premod",
|
||||
action: {
|
||||
action: record.active ? "created" : "removed",
|
||||
},
|
||||
date: new Date(record.createdAt),
|
||||
takenBy: record.createdBy ? record.createdBy.username : system,
|
||||
});
|
||||
// Merge in all the premod history items.
|
||||
user.status.premod.history.forEach(record => {
|
||||
history.push({
|
||||
kind: "premod",
|
||||
action: {
|
||||
action: record.active ? "created" : "removed",
|
||||
},
|
||||
date: new Date(record.createdAt),
|
||||
takenBy: record.createdBy ? record.createdBy.username : system,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
user.status.username.history.forEach((record, i) => {
|
||||
history.push({
|
||||
|
||||
@@ -66,8 +66,7 @@ const UserStatusChangeContainer: FunctionComponent<Props> = props => {
|
||||
}, [user, removeUserSuspension]);
|
||||
|
||||
const handlePremod = useCallback(() => {
|
||||
// FIXME: (wyattjoh) once migration has been performed, remove check
|
||||
if (user.status.premod && user.status.premod.active) {
|
||||
if (user.status.premod.active) {
|
||||
return;
|
||||
}
|
||||
setShowPremod(true);
|
||||
@@ -83,8 +82,7 @@ const UserStatusChangeContainer: FunctionComponent<Props> = props => {
|
||||
}, [setShowPremod]);
|
||||
|
||||
const handleRemovePremod = useCallback(() => {
|
||||
// FIXME: (wyattjoh) once migration has been performed, remove check
|
||||
if (!user.status.premod || !user.status.premod.active) {
|
||||
if (!user.status.premod.active) {
|
||||
return;
|
||||
}
|
||||
removeUserPremod({ userID: user.id });
|
||||
@@ -138,8 +136,7 @@ const UserStatusChangeContainer: FunctionComponent<Props> = props => {
|
||||
onRemovePremod={handleRemovePremod}
|
||||
banned={user.status.ban.active}
|
||||
suspended={user.status.suspension.active}
|
||||
// FIXME: (wyattjoh) once migration has been performed, remove check
|
||||
premod={Boolean(user.status.premod && user.status.premod.active)}
|
||||
premod={user.status.premod.active}
|
||||
fullWidth={fullWidth}
|
||||
>
|
||||
<UserStatusContainer user={user} />
|
||||
|
||||
Reference in New Issue
Block a user