* Don't allow transfer site.
* Updating translations.
* Adding leave admin team.
-Subproject commit b18bfc1a8d512d081056cf5aa1f422e4710ef683
+Subproject commit 0d63b5affe2273bb88b3593cdc13e4bb0f4d2d5d
"husky": "^7.0.4",
"import-sort-style-module": "^6.0.0",
"iso-639-1": "^2.1.10",
- "lemmy-js-client": "0.15.0",
+ "lemmy-js-client": "0.15.1-rc.1",
"lint-staged": "^12.1.2",
"mini-css-extract-plugin": "^2.4.5",
"node-fetch": "^2.6.1",
RemoveComment,
SaveComment,
TransferCommunity,
- TransferSite,
} from "lemmy-js-client";
import moment from "moment";
import { i18n } from "../../i18next";
))}
</>
)}
- {/* Site Creator can transfer to another admin */}
- {this.amSiteCreator &&
- this.isAdmin &&
- cv.creator.local &&
- (!this.state.showConfirmTransferSite ? (
- <button
- class="btn btn-link btn-animate text-muted"
- onClick={linkEvent(
- this,
- this.handleShowConfirmTransferSite
- )}
- aria-label={i18n.t("transfer_site")}
- >
- {i18n.t("transfer_site")}
- </button>
- ) : (
- <>
- <button
- class="btn btn-link btn-animate text-muted"
- aria-label={i18n.t("are_you_sure")}
- >
- {i18n.t("are_you_sure")}
- </button>
- <button
- class="btn btn-link btn-animate text-muted"
- onClick={linkEvent(
- this,
- this.handleTransferSite
- )}
- aria-label={i18n.t("yes")}
- >
- {i18n.t("yes")}
- </button>
- <button
- class="btn btn-link btn-animate text-muted"
- onClick={linkEvent(
- this,
- this.handleCancelShowConfirmTransferSite
- )}
- aria-label={i18n.t("no")}
- >
- {i18n.t("no")}
- </button>
- </>
- ))}
</>
)}
</>
i.setState(i.state);
}
- handleTransferSite(i: CommentNode) {
- let form: TransferSite = {
- person_id: i.props.node.comment_view.creator.id,
- auth: authField(),
- };
- WebSocketService.Instance.send(wsClient.transferSite(form));
- i.state.showConfirmTransferSite = false;
- i.setState(i.state);
- }
-
get isCommentNew(): boolean {
let now = moment.utc().subtract(10, "minutes");
let then = moment.utc(this.props.node.comment_view.comment.published);
loading: boolean;
banned: PersonViewSafe[];
siteConfigLoading: boolean;
+ leaveAdminTeamLoading: boolean;
}
export class AdminSettings extends Component<any, AdminSettingsState> {
banned: [],
loading: true,
siteConfigLoading: null,
+ leaveAdminTeamLoading: null,
};
constructor(props: any, context: any) {
</li>
))}
</ul>
+ {this.leaveAdmin()}
</>
);
}
+ leaveAdmin() {
+ return (
+ <button
+ onClick={linkEvent(this, this.handleLeaveAdminTeam)}
+ class="btn btn-danger mb-2"
+ >
+ {this.state.leaveAdminTeamLoading ? (
+ <Spinner />
+ ) : (
+ i18n.t("leave_admin_team")
+ )}
+ </button>
+ );
+ }
+
bannedUsers() {
return (
<>
i.setState(i.state);
}
+ handleLeaveAdminTeam(i: AdminSettings) {
+ i.state.leaveAdminTeamLoading = true;
+ WebSocketService.Instance.send(wsClient.leaveAdmin({ auth: authField() }));
+ i.setState(i.state);
+ }
+
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
this.setState(this.state);
var textarea: any = document.getElementById(this.siteConfigTextAreaId);
autosize(textarea);
+ } else if (op == UserOperation.LeaveAdmin) {
+ let data = wsJsonToRes<GetSiteResponse>(msg).data;
+ this.state.siteRes.site_view = data.site_view;
+ this.setState(this.state);
+ this.state.leaveAdminTeamLoading = false;
+ toast(i18n.t("left_admin_team"));
+ this.setState(this.state);
+ this.context.router.history.push("/");
} else if (op == UserOperation.SaveSiteConfig) {
let data = wsJsonToRes<GetSiteConfigResponse>(msg).data;
this.state.siteConfigRes = data;
SavePost,
StickyPost,
TransferCommunity,
- TransferSite,
} from "lemmy-js-client";
import { externalHost } from "../../env";
import { i18n } from "../../i18next";
)}
</>
)}
- {/* Site Creator can transfer to another admin */}
- {this.amSiteCreator &&
- this.creatorIsAdmin &&
- (!this.state.showConfirmTransferSite ? (
- <button
- class="btn btn-link btn-animate text-muted py-0"
- onClick={linkEvent(this, this.handleShowConfirmTransferSite)}
- aria-label={i18n.t("transfer_site")}
- >
- {i18n.t("transfer_site")}
- </button>
- ) : (
- <>
- <button
- class="btn btn-link btn-animate text-muted py-0 d-inline-block mr-1"
- aria-label={i18n.t("are_you_sure")}
- >
- {i18n.t("are_you_sure")}
- </button>
- <button
- class="btn btn-link btn-animate text-muted py-0 d-inline-block mr-1"
- onClick={linkEvent(this, this.handleTransferSite)}
- aria-label={i18n.t("yes")}
- >
- {i18n.t("yes")}
- </button>
- <button
- class="btn btn-link btn-animate text-muted py-0 d-inline-block"
- onClick={linkEvent(
- this,
- this.handleCancelShowConfirmTransferSite
- )}
- aria-label={i18n.t("no")}
- >
- {i18n.t("no")}
- </button>
- </>
- ))}
</>
)
);
i.setState(i.state);
}
- handleTransferSite(i: PostListing) {
- let form: TransferSite = {
- person_id: i.props.post_view.creator.id,
- auth: authField(),
- };
- WebSocketService.Instance.send(wsClient.transferSite(form));
- i.state.showConfirmTransferSite = false;
- i.setState(i.state);
- }
-
handleImageExpandClick(i: PostListing, event: any) {
event.preventDefault();
i.state.imageExpanded = !i.state.imageExpanded;
p => p.post.id != Number(this.props.match.params.id)
);
this.setState(this.state);
- } else if (op == UserOperation.TransferSite) {
+ } else if (op == UserOperation.LeaveAdmin) {
let data = wsJsonToRes<GetSiteResponse>(msg).data;
this.state.siteRes = data;
this.setState(this.state);
dependencies:
invert-kv "^1.0.0"
-lemmy-js-client@0.15.0:
- version "0.15.0"
- resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.15.0.tgz#984aadbfb2c8e7cebb61d429f0cf576245876a0b"
- integrity sha512-BWeI0cQOdjxDLHShyNGjYCMxdZf08sJnKKg2DNe9Js/sgMpv9OY9ZDiDOvV8R1QatqdAbwPv8HOgVQRAV6SYDQ==
+lemmy-js-client@0.15.1-rc.1:
+ version "0.15.1-rc.1"
+ resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.15.1-rc.1.tgz#9d914098eefc25834f077c4690d4e3e2ab4f2c57"
+ integrity sha512-rs80HTzwayt2EpjQ+ruQM82bZydjk9kZUUjZidYzwmy1FBkWpG5+OBnW3X6YQ5ebswiobL8HraNfnWMm0zqvjQ==
levn@^0.4.1:
version "0.4.1"