mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-12 19:06:13 +00:00
Upgrade for lemmy js client 0.19.0-alpha.16
(#2210)
* Use `auth` cookie set by backend instead of `jwt` (fixes #2193)
Requires https://github.com/LemmyNet/lemmy-js-client/pull/208
* Revert "Use `auth` cookie set by backend instead of `jwt` (fixes #2193)"
This reverts commit 442766c1d8
.
* Updating for new lemmy-js-client.
---------
Co-authored-by: Felix Ableitner <me@nutomic.com>
This commit is contained in:
parent
acfcd86b9b
commit
c3a57b114c
|
@ -1 +1 @@
|
||||||
Subproject commit 6b373bf7665ed58a81d8285009ad147248acfd7c
|
Subproject commit abd40d4737fa732321fd7b62e42bbfcd51081cb6
|
|
@ -70,7 +70,7 @@
|
||||||
"inferno-router": "^8.2.2",
|
"inferno-router": "^8.2.2",
|
||||||
"inferno-server": "^8.2.2",
|
"inferno-server": "^8.2.2",
|
||||||
"jwt-decode": "^3.1.2",
|
"jwt-decode": "^3.1.2",
|
||||||
"lemmy-js-client": "0.19.0-rc.14",
|
"lemmy-js-client": "0.19.0-alpha.16",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"markdown-it": "^13.0.1",
|
"markdown-it": "^13.0.1",
|
||||||
"markdown-it-bidi": "^0.1.0",
|
"markdown-it-bidi": "^0.1.0",
|
||||||
|
|
|
@ -56,6 +56,7 @@ export class CommentReport extends Component<
|
||||||
post: r.post,
|
post: r.post,
|
||||||
community: r.community,
|
community: r.community,
|
||||||
creator_banned_from_community: r.creator_banned_from_community,
|
creator_banned_from_community: r.creator_banned_from_community,
|
||||||
|
creator_is_moderator: false,
|
||||||
counts: r.counts,
|
counts: r.counts,
|
||||||
subscribed: "NotSubscribed",
|
subscribed: "NotSubscribed",
|
||||||
saved: false,
|
saved: false,
|
||||||
|
|
|
@ -57,12 +57,10 @@ import {
|
||||||
LockPost,
|
LockPost,
|
||||||
MarkCommentReplyAsRead,
|
MarkCommentReplyAsRead,
|
||||||
MarkPersonMentionAsRead,
|
MarkPersonMentionAsRead,
|
||||||
MarkPostAsRead,
|
|
||||||
PaginationCursor,
|
PaginationCursor,
|
||||||
PostResponse,
|
PostResponse,
|
||||||
PurgeComment,
|
PurgeComment,
|
||||||
PurgeCommunity,
|
PurgeCommunity,
|
||||||
PurgeItemResponse,
|
|
||||||
PurgePerson,
|
PurgePerson,
|
||||||
PurgePost,
|
PurgePost,
|
||||||
RemoveComment,
|
RemoveComment,
|
||||||
|
@ -71,6 +69,7 @@ import {
|
||||||
SaveComment,
|
SaveComment,
|
||||||
SavePost,
|
SavePost,
|
||||||
SortType,
|
SortType,
|
||||||
|
SuccessResponse,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { fetchLimit, relTags } from "../../config";
|
import { fetchLimit, relTags } from "../../config";
|
||||||
|
@ -198,7 +197,6 @@ export class Community extends Component<
|
||||||
this.handleSavePost = this.handleSavePost.bind(this);
|
this.handleSavePost = this.handleSavePost.bind(this);
|
||||||
this.handlePurgePost = this.handlePurgePost.bind(this);
|
this.handlePurgePost = this.handlePurgePost.bind(this);
|
||||||
this.handleFeaturePost = this.handleFeaturePost.bind(this);
|
this.handleFeaturePost = this.handleFeaturePost.bind(this);
|
||||||
this.handleMarkPostAsRead = this.handleMarkPostAsRead.bind(this);
|
|
||||||
this.mainContentRef = createRef();
|
this.mainContentRef = createRef();
|
||||||
// Only fetch the data if coming from another route
|
// Only fetch the data if coming from another route
|
||||||
if (FirstLoadService.isFirstLoad) {
|
if (FirstLoadService.isFirstLoad) {
|
||||||
|
@ -436,7 +434,7 @@ export class Community extends Component<
|
||||||
onAddAdmin={this.handleAddAdmin}
|
onAddAdmin={this.handleAddAdmin}
|
||||||
onTransferCommunity={this.handleTransferCommunity}
|
onTransferCommunity={this.handleTransferCommunity}
|
||||||
onFeaturePost={this.handleFeaturePost}
|
onFeaturePost={this.handleFeaturePost}
|
||||||
onMarkPostAsRead={this.handleMarkPostAsRead}
|
onMarkPostAsRead={() => {}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -804,11 +802,6 @@ export class Community extends Component<
|
||||||
await HttpService.client.markPersonMentionAsRead(form);
|
await HttpService.client.markPersonMentionAsRead(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleMarkPostAsRead(form: MarkPostAsRead) {
|
|
||||||
const res = await HttpService.client.markPostAsRead(form);
|
|
||||||
this.findAndUpdatePost(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleBanFromCommunity(form: BanFromCommunity) {
|
async handleBanFromCommunity(form: BanFromCommunity) {
|
||||||
const banRes = await HttpService.client.banFromCommunity(form);
|
const banRes = await HttpService.client.banFromCommunity(form);
|
||||||
this.updateBanFromCommunity(banRes);
|
this.updateBanFromCommunity(banRes);
|
||||||
|
@ -882,7 +875,7 @@ export class Community extends Component<
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
purgeItem(purgeRes: RequestState<PurgeItemResponse>) {
|
purgeItem(purgeRes: RequestState<SuccessResponse>) {
|
||||||
if (purgeRes.state === "success") {
|
if (purgeRes.state === "success") {
|
||||||
toast(I18NextService.i18n.t("purge_success"));
|
toast(I18NextService.i18n.t("purge_success"));
|
||||||
this.context.router.history.push(`/`);
|
this.context.router.history.push(`/`);
|
||||||
|
|
|
@ -359,7 +359,7 @@ export class AdminSettings extends Component<any, AdminSettingsState> {
|
||||||
async handleDeleteEmoji(form: DeleteCustomEmoji) {
|
async handleDeleteEmoji(form: DeleteCustomEmoji) {
|
||||||
const res = await HttpService.client.deleteCustomEmoji(form);
|
const res = await HttpService.client.deleteCustomEmoji(form);
|
||||||
if (res.state === "success") {
|
if (res.state === "success") {
|
||||||
removeFromEmojiDataModel(res.data.id);
|
removeFromEmojiDataModel(form.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,9 @@ import {
|
||||||
LockPost,
|
LockPost,
|
||||||
MarkCommentReplyAsRead,
|
MarkCommentReplyAsRead,
|
||||||
MarkPersonMentionAsRead,
|
MarkPersonMentionAsRead,
|
||||||
MarkPostAsRead,
|
|
||||||
PaginationCursor,
|
PaginationCursor,
|
||||||
PostResponse,
|
PostResponse,
|
||||||
PurgeComment,
|
PurgeComment,
|
||||||
PurgeItemResponse,
|
|
||||||
PurgePerson,
|
PurgePerson,
|
||||||
PurgePost,
|
PurgePost,
|
||||||
RemoveComment,
|
RemoveComment,
|
||||||
|
@ -70,6 +68,7 @@ import {
|
||||||
SaveComment,
|
SaveComment,
|
||||||
SavePost,
|
SavePost,
|
||||||
SortType,
|
SortType,
|
||||||
|
SuccessResponse,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { fetchLimit, relTags, trendingFetchLimit } from "../../config";
|
import { fetchLimit, relTags, trendingFetchLimit } from "../../config";
|
||||||
|
@ -276,7 +275,6 @@ export class Home extends Component<any, HomeState> {
|
||||||
this.handleSavePost = this.handleSavePost.bind(this);
|
this.handleSavePost = this.handleSavePost.bind(this);
|
||||||
this.handlePurgePost = this.handlePurgePost.bind(this);
|
this.handlePurgePost = this.handlePurgePost.bind(this);
|
||||||
this.handleFeaturePost = this.handleFeaturePost.bind(this);
|
this.handleFeaturePost = this.handleFeaturePost.bind(this);
|
||||||
this.handleMarkPostAsRead = this.handleMarkPostAsRead.bind(this);
|
|
||||||
|
|
||||||
// Only fetch the data if coming from another route
|
// Only fetch the data if coming from another route
|
||||||
if (FirstLoadService.isFirstLoad) {
|
if (FirstLoadService.isFirstLoad) {
|
||||||
|
@ -713,7 +711,7 @@ export class Home extends Component<any, HomeState> {
|
||||||
onAddAdmin={this.handleAddAdmin}
|
onAddAdmin={this.handleAddAdmin}
|
||||||
onTransferCommunity={this.handleTransferCommunity}
|
onTransferCommunity={this.handleTransferCommunity}
|
||||||
onFeaturePost={this.handleFeaturePost}
|
onFeaturePost={this.handleFeaturePost}
|
||||||
onMarkPostAsRead={this.handleMarkPostAsRead}
|
onMarkPostAsRead={() => {}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1043,11 +1041,6 @@ export class Home extends Component<any, HomeState> {
|
||||||
this.updateBan(banRes);
|
this.updateBan(banRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleMarkPostAsRead(form: MarkPostAsRead) {
|
|
||||||
const res = await HttpService.client.markPostAsRead(form);
|
|
||||||
this.findAndUpdatePost(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateBanFromCommunity(banRes: RequestState<BanFromCommunityResponse>) {
|
updateBanFromCommunity(banRes: RequestState<BanFromCommunityResponse>) {
|
||||||
// Maybe not necessary
|
// Maybe not necessary
|
||||||
if (banRes.state === "success") {
|
if (banRes.state === "success") {
|
||||||
|
@ -1090,7 +1083,7 @@ export class Home extends Component<any, HomeState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
purgeItem(purgeRes: RequestState<PurgeItemResponse>) {
|
purgeItem(purgeRes: RequestState<SuccessResponse>) {
|
||||||
if (purgeRes.state === "success") {
|
if (purgeRes.state === "success") {
|
||||||
toast(I18NextService.i18n.t("purge_success"));
|
toast(I18NextService.i18n.t("purge_success"));
|
||||||
this.context.router.history.push(`/`);
|
this.context.router.history.push(`/`);
|
||||||
|
|
|
@ -52,11 +52,11 @@ import {
|
||||||
PrivateMessageView,
|
PrivateMessageView,
|
||||||
PrivateMessagesResponse,
|
PrivateMessagesResponse,
|
||||||
PurgeComment,
|
PurgeComment,
|
||||||
PurgeItemResponse,
|
|
||||||
PurgePerson,
|
PurgePerson,
|
||||||
PurgePost,
|
PurgePost,
|
||||||
RemoveComment,
|
RemoveComment,
|
||||||
SaveComment,
|
SaveComment,
|
||||||
|
SuccessResponse,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { fetchLimit, relTags } from "../../config";
|
import { fetchLimit, relTags } from "../../config";
|
||||||
|
@ -1038,7 +1038,7 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
purgeItem(purgeRes: RequestState<PurgeItemResponse>) {
|
purgeItem(purgeRes: RequestState<SuccessResponse>) {
|
||||||
if (purgeRes.state === "success") {
|
if (purgeRes.state === "success") {
|
||||||
toast(I18NextService.i18n.t("purge_success"));
|
toast(I18NextService.i18n.t("purge_success"));
|
||||||
this.context.router.history.push(`/`);
|
this.context.router.history.push(`/`);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { setIsoData } from "@utils/app";
|
import { setIsoData } from "@utils/app";
|
||||||
import { capitalizeFirstLetter } from "@utils/helpers";
|
import { capitalizeFirstLetter } from "@utils/helpers";
|
||||||
import { Component, linkEvent } from "inferno";
|
import { Component, linkEvent } from "inferno";
|
||||||
import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
|
import { GetSiteResponse, SuccessResponse } from "lemmy-js-client";
|
||||||
import { HttpService, I18NextService, UserService } from "../../services";
|
import { HttpService, I18NextService, UserService } from "../../services";
|
||||||
import {
|
import {
|
||||||
EMPTY_REQUEST,
|
EMPTY_REQUEST,
|
||||||
|
@ -11,9 +11,10 @@ import {
|
||||||
import { HtmlTags } from "../common/html-tags";
|
import { HtmlTags } from "../common/html-tags";
|
||||||
import { Spinner } from "../common/icon";
|
import { Spinner } from "../common/icon";
|
||||||
import PasswordInput from "../common/password-input";
|
import PasswordInput from "../common/password-input";
|
||||||
|
import { toast } from "../../toast";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
passwordChangeRes: RequestState<LoginResponse>;
|
passwordChangeRes: RequestState<SuccessResponse>;
|
||||||
form: {
|
form: {
|
||||||
token: string;
|
token: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
|
@ -125,10 +126,7 @@ export class PasswordChange extends Component<any, State> {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (i.state.passwordChangeRes.state === "success") {
|
if (i.state.passwordChangeRes.state === "success") {
|
||||||
const data = i.state.passwordChangeRes.data;
|
toast(I18NextService.i18n.t("password_changed"));
|
||||||
UserService.Instance.login({
|
|
||||||
res: data,
|
|
||||||
});
|
|
||||||
|
|
||||||
const site = await HttpService.client.getSite();
|
const site = await HttpService.client.getSite();
|
||||||
if (site.state === "success") {
|
if (site.state === "success") {
|
||||||
|
|
|
@ -58,11 +58,9 @@ import {
|
||||||
LockPost,
|
LockPost,
|
||||||
MarkCommentReplyAsRead,
|
MarkCommentReplyAsRead,
|
||||||
MarkPersonMentionAsRead,
|
MarkPersonMentionAsRead,
|
||||||
MarkPostAsRead,
|
|
||||||
PersonView,
|
PersonView,
|
||||||
PostResponse,
|
PostResponse,
|
||||||
PurgeComment,
|
PurgeComment,
|
||||||
PurgeItemResponse,
|
|
||||||
PurgePerson,
|
PurgePerson,
|
||||||
PurgePost,
|
PurgePost,
|
||||||
RemoveComment,
|
RemoveComment,
|
||||||
|
@ -70,6 +68,7 @@ import {
|
||||||
SaveComment,
|
SaveComment,
|
||||||
SavePost,
|
SavePost,
|
||||||
SortType,
|
SortType,
|
||||||
|
SuccessResponse,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { fetchLimit, relTags } from "../../config";
|
import { fetchLimit, relTags } from "../../config";
|
||||||
|
@ -222,7 +221,6 @@ export class Profile extends Component<
|
||||||
this.handlePurgePost = this.handlePurgePost.bind(this);
|
this.handlePurgePost = this.handlePurgePost.bind(this);
|
||||||
this.handleFeaturePost = this.handleFeaturePost.bind(this);
|
this.handleFeaturePost = this.handleFeaturePost.bind(this);
|
||||||
this.handleModBanSubmit = this.handleModBanSubmit.bind(this);
|
this.handleModBanSubmit = this.handleModBanSubmit.bind(this);
|
||||||
this.handleMarkPostAsRead = this.handleMarkPostAsRead.bind(this);
|
|
||||||
|
|
||||||
// Only fetch the data if coming from another route
|
// Only fetch the data if coming from another route
|
||||||
if (FirstLoadService.isFirstLoad) {
|
if (FirstLoadService.isFirstLoad) {
|
||||||
|
@ -378,7 +376,7 @@ export class Profile extends Component<
|
||||||
onSavePost={this.handleSavePost}
|
onSavePost={this.handleSavePost}
|
||||||
onPurgePost={this.handlePurgePost}
|
onPurgePost={this.handlePurgePost}
|
||||||
onFeaturePost={this.handleFeaturePost}
|
onFeaturePost={this.handleFeaturePost}
|
||||||
onMarkPostAsRead={this.handleMarkPostAsRead}
|
onMarkPostAsRead={() => {}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -947,11 +945,6 @@ export class Profile extends Component<
|
||||||
await HttpService.client.markPersonMentionAsRead(form);
|
await HttpService.client.markPersonMentionAsRead(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleMarkPostAsRead(form: MarkPostAsRead) {
|
|
||||||
const res = await HttpService.client.markPostAsRead(form);
|
|
||||||
this.findAndUpdatePost(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleBanFromCommunity(form: BanFromCommunity) {
|
async handleBanFromCommunity(form: BanFromCommunity) {
|
||||||
const banRes = await HttpService.client.banFromCommunity(form);
|
const banRes = await HttpService.client.banFromCommunity(form);
|
||||||
this.updateBanFromCommunity(banRes);
|
this.updateBanFromCommunity(banRes);
|
||||||
|
@ -1002,7 +995,7 @@ export class Profile extends Component<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
purgeItem(purgeRes: RequestState<PurgeItemResponse>) {
|
purgeItem(purgeRes: RequestState<SuccessResponse>) {
|
||||||
if (purgeRes.state === "success") {
|
if (purgeRes.state === "success") {
|
||||||
toast(I18NextService.i18n.t("purge_success"));
|
toast(I18NextService.i18n.t("purge_success"));
|
||||||
this.context.router.history.push(`/`);
|
this.context.router.history.push(`/`);
|
||||||
|
|
|
@ -23,7 +23,6 @@ import {
|
||||||
BlockInstanceResponse,
|
BlockInstanceResponse,
|
||||||
BlockPersonResponse,
|
BlockPersonResponse,
|
||||||
CommunityBlockView,
|
CommunityBlockView,
|
||||||
DeleteAccountResponse,
|
|
||||||
GenerateTotpSecretResponse,
|
GenerateTotpSecretResponse,
|
||||||
GetFederatedInstancesResponse,
|
GetFederatedInstancesResponse,
|
||||||
GetSiteResponse,
|
GetSiteResponse,
|
||||||
|
@ -33,6 +32,7 @@ import {
|
||||||
LoginResponse,
|
LoginResponse,
|
||||||
PersonBlockView,
|
PersonBlockView,
|
||||||
SortType,
|
SortType,
|
||||||
|
SuccessResponse,
|
||||||
UpdateTotpResponse,
|
UpdateTotpResponse,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { elementUrl, emDash, relTags } from "../../config";
|
import { elementUrl, emDash, relTags } from "../../config";
|
||||||
|
@ -66,9 +66,9 @@ type SettingsData = RouteDataResponse<{
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
interface SettingsState {
|
interface SettingsState {
|
||||||
saveRes: RequestState<LoginResponse>;
|
saveRes: RequestState<SuccessResponse>;
|
||||||
changePasswordRes: RequestState<LoginResponse>;
|
changePasswordRes: RequestState<LoginResponse>;
|
||||||
deleteAccountRes: RequestState<DeleteAccountResponse>;
|
deleteAccountRes: RequestState<SuccessResponse>;
|
||||||
instancesRes: RequestState<GetFederatedInstancesResponse>;
|
instancesRes: RequestState<GetFederatedInstancesResponse>;
|
||||||
generateTotpRes: RequestState<GenerateTotpSecretResponse>;
|
generateTotpRes: RequestState<GenerateTotpSecretResponse>;
|
||||||
updateTotpRes: RequestState<UpdateTotpResponse>;
|
updateTotpRes: RequestState<UpdateTotpResponse>;
|
||||||
|
@ -1436,11 +1436,6 @@ export class Settings extends Component<any, SettingsState> {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (saveRes.state === "success") {
|
if (saveRes.state === "success") {
|
||||||
UserService.Instance.login({
|
|
||||||
res: saveRes.data,
|
|
||||||
showToast: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const siteRes = await HttpService.client.getSite();
|
const siteRes = await HttpService.client.getSite();
|
||||||
|
|
||||||
if (siteRes.state === "success") {
|
if (siteRes.state === "success") {
|
||||||
|
@ -1471,10 +1466,6 @@ export class Settings extends Component<any, SettingsState> {
|
||||||
old_password,
|
old_password,
|
||||||
});
|
});
|
||||||
if (changePasswordRes.state === "success") {
|
if (changePasswordRes.state === "success") {
|
||||||
UserService.Instance.login({
|
|
||||||
res: changePasswordRes.data,
|
|
||||||
showToast: false,
|
|
||||||
});
|
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
toast(I18NextService.i18n.t("password_changed"));
|
toast(I18NextService.i18n.t("password_changed"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { setIsoData } from "@utils/app";
|
import { setIsoData } from "@utils/app";
|
||||||
import { Component } from "inferno";
|
import { Component } from "inferno";
|
||||||
import { GetSiteResponse, VerifyEmailResponse } from "lemmy-js-client";
|
import { GetSiteResponse, SuccessResponse } from "lemmy-js-client";
|
||||||
import { I18NextService } from "../../services";
|
import { I18NextService } from "../../services";
|
||||||
import {
|
import {
|
||||||
EMPTY_REQUEST,
|
EMPTY_REQUEST,
|
||||||
|
@ -13,7 +13,7 @@ import { HtmlTags } from "../common/html-tags";
|
||||||
import { Spinner } from "../common/icon";
|
import { Spinner } from "../common/icon";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
verifyRes: RequestState<VerifyEmailResponse>;
|
verifyRes: RequestState<SuccessResponse>;
|
||||||
siteRes: GetSiteResponse;
|
siteRes: GetSiteResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ export class PostReport extends Component<PostReportProps, PostReportState> {
|
||||||
creator_blocked: false,
|
creator_blocked: false,
|
||||||
my_vote: r.my_vote,
|
my_vote: r.my_vote,
|
||||||
unread_comments: 0,
|
unread_comments: 0,
|
||||||
|
creator_is_moderator: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -61,12 +61,9 @@ import {
|
||||||
GetSiteResponse,
|
GetSiteResponse,
|
||||||
LockPost,
|
LockPost,
|
||||||
MarkCommentReplyAsRead,
|
MarkCommentReplyAsRead,
|
||||||
MarkPersonMentionAsRead,
|
|
||||||
MarkPostAsRead,
|
|
||||||
PostResponse,
|
PostResponse,
|
||||||
PurgeComment,
|
PurgeComment,
|
||||||
PurgeCommunity,
|
PurgeCommunity,
|
||||||
PurgeItemResponse,
|
|
||||||
PurgePerson,
|
PurgePerson,
|
||||||
PurgePost,
|
PurgePost,
|
||||||
RemoveComment,
|
RemoveComment,
|
||||||
|
@ -74,6 +71,7 @@ import {
|
||||||
RemovePost,
|
RemovePost,
|
||||||
SaveComment,
|
SaveComment,
|
||||||
SavePost,
|
SavePost,
|
||||||
|
SuccessResponse,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { commentTreeMaxDepth } from "../../config";
|
import { commentTreeMaxDepth } from "../../config";
|
||||||
|
@ -164,7 +162,6 @@ export class Post extends Component<any, PostState> {
|
||||||
this.handleTransferCommunity = this.handleTransferCommunity.bind(this);
|
this.handleTransferCommunity = this.handleTransferCommunity.bind(this);
|
||||||
this.handleFetchChildren = this.handleFetchChildren.bind(this);
|
this.handleFetchChildren = this.handleFetchChildren.bind(this);
|
||||||
this.handleCommentReplyRead = this.handleCommentReplyRead.bind(this);
|
this.handleCommentReplyRead = this.handleCommentReplyRead.bind(this);
|
||||||
this.handlePersonMentionRead = this.handlePersonMentionRead.bind(this);
|
|
||||||
this.handleBanFromCommunity = this.handleBanFromCommunity.bind(this);
|
this.handleBanFromCommunity = this.handleBanFromCommunity.bind(this);
|
||||||
this.handleBanPerson = this.handleBanPerson.bind(this);
|
this.handleBanPerson = this.handleBanPerson.bind(this);
|
||||||
this.handlePostEdit = this.handlePostEdit.bind(this);
|
this.handlePostEdit = this.handlePostEdit.bind(this);
|
||||||
|
@ -176,7 +173,6 @@ export class Post extends Component<any, PostState> {
|
||||||
this.handleSavePost = this.handleSavePost.bind(this);
|
this.handleSavePost = this.handleSavePost.bind(this);
|
||||||
this.handlePurgePost = this.handlePurgePost.bind(this);
|
this.handlePurgePost = this.handlePurgePost.bind(this);
|
||||||
this.handleFeaturePost = this.handleFeaturePost.bind(this);
|
this.handleFeaturePost = this.handleFeaturePost.bind(this);
|
||||||
this.handleMarkPostAsRead = this.handleMarkPostAsRead.bind(this);
|
|
||||||
|
|
||||||
this.state = { ...this.state, commentSectionRef: createRef() };
|
this.state = { ...this.state, commentSectionRef: createRef() };
|
||||||
|
|
||||||
|
@ -387,7 +383,7 @@ export class Post extends Component<any, PostState> {
|
||||||
onAddAdmin={this.handleAddAdmin}
|
onAddAdmin={this.handleAddAdmin}
|
||||||
onTransferCommunity={this.handleTransferCommunity}
|
onTransferCommunity={this.handleTransferCommunity}
|
||||||
onFeaturePost={this.handleFeaturePost}
|
onFeaturePost={this.handleFeaturePost}
|
||||||
onMarkPostAsRead={this.handleMarkPostAsRead}
|
onMarkPostAsRead={() => {}}
|
||||||
/>
|
/>
|
||||||
<div ref={this.state.commentSectionRef} className="mb-2" />
|
<div ref={this.state.commentSectionRef} className="mb-2" />
|
||||||
|
|
||||||
|
@ -589,7 +585,7 @@ export class Post extends Component<any, PostState> {
|
||||||
onPurgeComment={this.handlePurgeComment}
|
onPurgeComment={this.handlePurgeComment}
|
||||||
onPurgePerson={this.handlePurgePerson}
|
onPurgePerson={this.handlePurgePerson}
|
||||||
onCommentReplyRead={this.handleCommentReplyRead}
|
onCommentReplyRead={this.handleCommentReplyRead}
|
||||||
onPersonMentionRead={this.handlePersonMentionRead}
|
onPersonMentionRead={() => {}}
|
||||||
onBanPersonFromCommunity={this.handleBanFromCommunity}
|
onBanPersonFromCommunity={this.handleBanFromCommunity}
|
||||||
onBanPerson={this.handleBanPerson}
|
onBanPerson={this.handleBanPerson}
|
||||||
onCreateComment={this.handleCreateComment}
|
onCreateComment={this.handleCreateComment}
|
||||||
|
@ -676,7 +672,7 @@ export class Post extends Component<any, PostState> {
|
||||||
onPurgeComment={this.handlePurgeComment}
|
onPurgeComment={this.handlePurgeComment}
|
||||||
onPurgePerson={this.handlePurgePerson}
|
onPurgePerson={this.handlePurgePerson}
|
||||||
onCommentReplyRead={this.handleCommentReplyRead}
|
onCommentReplyRead={this.handleCommentReplyRead}
|
||||||
onPersonMentionRead={this.handlePersonMentionRead}
|
onPersonMentionRead={() => {}}
|
||||||
onBanPersonFromCommunity={this.handleBanFromCommunity}
|
onBanPersonFromCommunity={this.handleBanFromCommunity}
|
||||||
onBanPerson={this.handleBanPerson}
|
onBanPerson={this.handleBanPerson}
|
||||||
onCreateComment={this.handleCreateComment}
|
onCreateComment={this.handleCreateComment}
|
||||||
|
@ -936,16 +932,6 @@ export class Post extends Component<any, PostState> {
|
||||||
this.findAndUpdateCommentReply(readRes);
|
this.findAndUpdateCommentReply(readRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
async handlePersonMentionRead(form: MarkPersonMentionAsRead) {
|
|
||||||
// TODO not sure what to do here. Maybe it is actually optional, because post doesn't need it.
|
|
||||||
await HttpService.client.markPersonMentionAsRead(form);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleMarkPostAsRead(form: MarkPostAsRead) {
|
|
||||||
const res = await HttpService.client.markPostAsRead(form);
|
|
||||||
this.updatePost(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleBanFromCommunity(form: BanFromCommunity) {
|
async handleBanFromCommunity(form: BanFromCommunity) {
|
||||||
const banRes = await HttpService.client.banFromCommunity(form);
|
const banRes = await HttpService.client.banFromCommunity(form);
|
||||||
this.updateBan(banRes);
|
this.updateBan(banRes);
|
||||||
|
@ -1029,7 +1015,7 @@ export class Post extends Component<any, PostState> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
purgeItem(purgeRes: RequestState<PurgeItemResponse>) {
|
purgeItem(purgeRes: RequestState<SuccessResponse>) {
|
||||||
if (purgeRes.state === "success") {
|
if (purgeRes.state === "success") {
|
||||||
toast(I18NextService.i18n.t("purge_success"));
|
toast(I18NextService.i18n.t("purge_success"));
|
||||||
this.context.router.history.push(`/`);
|
this.context.router.history.push(`/`);
|
||||||
|
|
|
@ -665,10 +665,10 @@ export class Search extends Component<any, SearchState> {
|
||||||
Number(
|
Number(
|
||||||
((b.data as CommentView | PostView).counts.score |
|
((b.data as CommentView | PostView).counts.score |
|
||||||
(b.data as CommunityView).counts.subscribers |
|
(b.data as CommunityView).counts.subscribers |
|
||||||
(b.data as PersonView).counts.comment_score) -
|
(b.data as PersonView).counts.comment_count) -
|
||||||
((a.data as CommentView | PostView).counts.score |
|
((a.data as CommentView | PostView).counts.score |
|
||||||
(a.data as CommunityView).counts.subscribers |
|
(a.data as CommunityView).counts.subscribers |
|
||||||
(a.data as PersonView).counts.comment_score),
|
(a.data as PersonView).counts.comment_count),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,6 @@ export class UserService {
|
||||||
res: LoginResponse;
|
res: LoginResponse;
|
||||||
showToast?: boolean;
|
showToast?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const expires = new Date();
|
|
||||||
expires.setDate(expires.getDate() + 365);
|
|
||||||
|
|
||||||
if (isBrowser() && res.jwt) {
|
if (isBrowser() && res.jwt) {
|
||||||
showToast && toast(I18NextService.i18n.t("logged_in"));
|
showToast && toast(I18NextService.i18n.t("logged_in"));
|
||||||
setAuthCookie(res.jwt);
|
setAuthCookie(res.jwt);
|
||||||
|
@ -53,6 +50,8 @@ export class UserService {
|
||||||
clearAuthCookie();
|
clearAuthCookie();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpService.client.logout();
|
||||||
|
|
||||||
if (isAuthPath(location.pathname)) {
|
if (isAuthPath(location.pathname)) {
|
||||||
location.replace("/");
|
location.replace("/");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6069,10 +6069,10 @@ leac@^0.6.0:
|
||||||
resolved "https://registry.yarnpkg.com/leac/-/leac-0.6.0.tgz#dcf136e382e666bd2475f44a1096061b70dc0912"
|
resolved "https://registry.yarnpkg.com/leac/-/leac-0.6.0.tgz#dcf136e382e666bd2475f44a1096061b70dc0912"
|
||||||
integrity sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==
|
integrity sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==
|
||||||
|
|
||||||
lemmy-js-client@0.19.0-rc.14:
|
lemmy-js-client@0.19.0-alpha.16:
|
||||||
version "0.19.0-rc.14"
|
version "0.19.0-alpha.16"
|
||||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.19.0-rc.14.tgz#41885611c2d78e5cb6b01cf167d68205a471c215"
|
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.19.0-alpha.16.tgz#4ec26e393856db7ddf86dba83f24633eeacee7c4"
|
||||||
integrity sha512-U0KKFLrU0K+A7UlZr+k4olrXCXBxD+9cwMicu7L/wFyZ2aWHtGPaeO8V6mk6suv9vn2w2PWuimIIC+YICQ5xKg==
|
integrity sha512-pmfrkPrHBkhEFhw/BDiTPy2/aQLoURLwBftMa4Lc+ZYiRfVClCOPkbKiqDSYXYlWcPz5MtwM/bjSNxasvVHfTA==
|
||||||
dependencies:
|
dependencies:
|
||||||
cross-fetch "^3.1.5"
|
cross-fetch "^3.1.5"
|
||||||
form-data "^4.0.0"
|
form-data "^4.0.0"
|
||||||
|
|
Loading…
Reference in a new issue