mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 06:36:17 +00:00
Updating v2 API based on nutomics recommends.
This commit is contained in:
parent
a2b0f6ec04
commit
6a3329f9a2
|
@ -67,7 +67,7 @@
|
|||
"eslint": "^7.16.0",
|
||||
"eslint-plugin-jane": "^9.0.6",
|
||||
"husky": "^4.3.6",
|
||||
"lemmy-js-client": "1.0.17-beta6",
|
||||
"lemmy-js-client": "0.9.0-rc.12",
|
||||
"lint-staged": "^10.5.3",
|
||||
"mini-css-extract-plugin": "^1.3.3",
|
||||
"node-fetch": "^2.6.1",
|
||||
|
|
|
@ -109,7 +109,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
|
|||
let form: EditComment = {
|
||||
content,
|
||||
form_id: this.state.formId,
|
||||
edit_id: node.comment_view.comment.id,
|
||||
comment_id: node.comment_view.comment.id,
|
||||
auth: authField(),
|
||||
};
|
||||
WebSocketService.Instance.send(wsClient.editComment(form));
|
||||
|
|
|
@ -854,7 +854,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
handleDeleteClick(i: CommentNode) {
|
||||
let comment = i.props.node.comment_view.comment;
|
||||
let deleteForm: DeleteComment = {
|
||||
edit_id: comment.id,
|
||||
comment_id: comment.id,
|
||||
deleted: !comment.deleted,
|
||||
auth: authField(),
|
||||
};
|
||||
|
@ -956,7 +956,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
handleModRemoveSubmit(i: CommentNode) {
|
||||
let comment = i.props.node.comment_view.comment;
|
||||
let form: RemoveComment = {
|
||||
edit_id: comment.id,
|
||||
comment_id: comment.id,
|
||||
removed: !comment.removed,
|
||||
reason: i.state.removeReason,
|
||||
auth: authField(),
|
||||
|
|
|
@ -283,7 +283,7 @@ export class CommunityForm extends Component<
|
|||
if (i.props.community_view) {
|
||||
let form: EditCommunity = {
|
||||
...i.state.communityForm,
|
||||
edit_id: i.props.community_view.community.id,
|
||||
community_id: i.props.community_view.community.id,
|
||||
};
|
||||
WebSocketService.Instance.send(wsClient.editCommunity(form));
|
||||
} else {
|
||||
|
|
|
@ -48,7 +48,6 @@ export class Login extends Component<any, State> {
|
|||
username: undefined,
|
||||
password: undefined,
|
||||
password_verify: undefined,
|
||||
admin: false,
|
||||
show_nsfw: false,
|
||||
captcha_uuid: undefined,
|
||||
captcha_answer: undefined,
|
||||
|
|
|
@ -377,7 +377,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
|||
if (i.props.post_view) {
|
||||
let form: EditPost = {
|
||||
...i.state.postForm,
|
||||
edit_id: i.props.post_view.post.id,
|
||||
post_id: i.props.post_view.post.id,
|
||||
};
|
||||
WebSocketService.Instance.send(wsClient.editPost(form));
|
||||
} else {
|
||||
|
|
|
@ -1237,7 +1237,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
|
||||
handleDeleteClick(i: PostListing) {
|
||||
let deleteForm: DeletePost = {
|
||||
edit_id: i.props.post_view.post.id,
|
||||
post_id: i.props.post_view.post.id,
|
||||
deleted: !i.props.post_view.post.deleted,
|
||||
auth: authField(),
|
||||
};
|
||||
|
@ -1287,7 +1287,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
handleModRemoveSubmit(i: PostListing) {
|
||||
event.preventDefault();
|
||||
let form: RemovePost = {
|
||||
edit_id: i.props.post_view.post.id,
|
||||
post_id: i.props.post_view.post.id,
|
||||
removed: !i.props.post_view.post.removed,
|
||||
reason: i.state.removeReason,
|
||||
auth: authField(),
|
||||
|
@ -1300,7 +1300,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
|
||||
handleModLock(i: PostListing) {
|
||||
let form: LockPost = {
|
||||
edit_id: i.props.post_view.post.id,
|
||||
post_id: i.props.post_view.post.id,
|
||||
locked: !i.props.post_view.post.locked,
|
||||
auth: authField(),
|
||||
};
|
||||
|
@ -1309,7 +1309,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
|
||||
handleModSticky(i: PostListing) {
|
||||
let form: StickyPost = {
|
||||
edit_id: i.props.post_view.post.id,
|
||||
post_id: i.props.post_view.post.id,
|
||||
stickied: !i.props.post_view.post.stickied,
|
||||
auth: authField(),
|
||||
};
|
||||
|
|
|
@ -191,7 +191,7 @@ export class PrivateMessageForm extends Component<
|
|||
event.preventDefault();
|
||||
if (i.props.privateMessage) {
|
||||
let form: EditPrivateMessage = {
|
||||
edit_id: i.props.privateMessage.private_message.id,
|
||||
private_message_id: i.props.privateMessage.private_message.id,
|
||||
content: i.state.privateMessageForm.content,
|
||||
auth: authField(),
|
||||
};
|
||||
|
|
|
@ -229,7 +229,7 @@ export class PrivateMessage extends Component<
|
|||
|
||||
handleDeleteClick(i: PrivateMessage) {
|
||||
let form: DeletePrivateMessage = {
|
||||
edit_id: i.props.private_message_view.private_message.id,
|
||||
private_message_id: i.props.private_message_view.private_message.id,
|
||||
deleted: !i.props.private_message_view.private_message.deleted,
|
||||
auth: authField(),
|
||||
};
|
||||
|
@ -244,7 +244,7 @@ export class PrivateMessage extends Component<
|
|||
|
||||
handleMarkRead(i: PrivateMessage) {
|
||||
let form: MarkPrivateMessageAsRead = {
|
||||
edit_id: i.props.private_message_view.private_message.id,
|
||||
private_message_id: i.props.private_message_view.private_message.id,
|
||||
read: !i.props.private_message_view.private_message.read,
|
||||
auth: authField(),
|
||||
};
|
||||
|
|
|
@ -22,7 +22,6 @@ export class Setup extends Component<any, State> {
|
|||
username: undefined,
|
||||
password: undefined,
|
||||
password_verify: undefined,
|
||||
admin: true,
|
||||
show_nsfw: true,
|
||||
// The first admin signup doesn't need a captcha
|
||||
captcha_uuid: '',
|
||||
|
|
|
@ -392,7 +392,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
|||
handleDeleteClick(i: Sidebar, event: any) {
|
||||
event.preventDefault();
|
||||
let deleteForm: DeleteCommunity = {
|
||||
edit_id: i.props.community_view.community.id,
|
||||
community_id: i.props.community_view.community.id,
|
||||
deleted: !i.props.community_view.community.deleted,
|
||||
auth: authField(),
|
||||
};
|
||||
|
@ -482,7 +482,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
|||
handleModRemoveSubmit(i: Sidebar, event: any) {
|
||||
event.preventDefault();
|
||||
let removeForm: RemoveCommunity = {
|
||||
edit_id: i.props.community_view.community.id,
|
||||
community_id: i.props.community_view.community.id,
|
||||
removed: !i.props.community_view.community.removed,
|
||||
reason: i.state.removeReason,
|
||||
expires: getUnixTime(i.state.removeExpires),
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { User_ } from 'lemmy-js-client';
|
||||
import { UserSafeSettings } from 'lemmy-js-client';
|
||||
import { Helmet } from 'inferno-helmet';
|
||||
import { Component } from 'inferno';
|
||||
|
||||
interface Props {
|
||||
user: User_ | undefined;
|
||||
user: UserSafeSettings | undefined;
|
||||
}
|
||||
|
||||
export class Theme extends Component<Props> {
|
||||
|
|
|
@ -150,8 +150,6 @@ export class User extends Component<any, UserState> {
|
|||
// Only fetch the data if coming from another route
|
||||
if (this.isoData.path == this.context.router.route.match.url) {
|
||||
this.state.userRes = this.isoData.routeData[0];
|
||||
this.state.userRes.user_view =
|
||||
this.state.userRes.user_view || this.state.userRes.user_view_dangerous;
|
||||
this.setUserInfo();
|
||||
this.state.loading = false;
|
||||
} else {
|
||||
|
@ -1106,8 +1104,6 @@ export class User extends Component<any, UserState> {
|
|||
// TODO this might need to get abstracted
|
||||
let data = wsJsonToRes<GetUserDetailsResponse>(msg).data;
|
||||
this.state.userRes = data;
|
||||
this.state.userRes.user_view =
|
||||
this.state.userRes.user_view || this.state.userRes.user_view_dangerous;
|
||||
this.setUserInfo();
|
||||
this.state.loading = false;
|
||||
this.setState(this.state);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// import Cookies from 'js-cookie';
|
||||
import IsomorphicCookie from 'isomorphic-cookie';
|
||||
import { User_, LoginResponse } from 'lemmy-js-client';
|
||||
import { UserSafeSettings, LoginResponse } from 'lemmy-js-client';
|
||||
import jwt_decode from 'jwt-decode';
|
||||
import { Subject, BehaviorSubject } from 'rxjs';
|
||||
|
||||
|
@ -11,7 +11,7 @@ interface Claims {
|
|||
|
||||
export class UserService {
|
||||
private static _instance: UserService;
|
||||
public user: User_;
|
||||
public user: UserSafeSettings;
|
||||
public claims: Claims;
|
||||
public jwtSub: Subject<string> = new Subject<string>();
|
||||
public unreadCountSub: BehaviorSubject<number> = new BehaviorSubject<number>(
|
||||
|
|
|
@ -31,7 +31,7 @@ import 'moment/locale/da';
|
|||
import {
|
||||
UserOperation,
|
||||
CommentView,
|
||||
User_,
|
||||
UserSafeSettings,
|
||||
SortType,
|
||||
ListingType,
|
||||
SearchType,
|
||||
|
@ -239,7 +239,7 @@ export function getUnixTime(text: string): number {
|
|||
}
|
||||
|
||||
export function canMod(
|
||||
user: User_,
|
||||
user: UserSafeSettings,
|
||||
modIds: number[],
|
||||
creator_id: number,
|
||||
onSelf: boolean = false
|
||||
|
|
|
@ -5555,10 +5555,10 @@ lcid@^1.0.0:
|
|||
dependencies:
|
||||
invert-kv "^1.0.0"
|
||||
|
||||
lemmy-js-client@1.0.17-beta6:
|
||||
version "1.0.17-beta6"
|
||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-1.0.17-beta6.tgz#afe1e1da13172a161c4d976b1ee58fe81eb22829"
|
||||
integrity sha512-+oX7J7wht8nH4a5NQngK1GNner3TDv6ZOhQQVI5KcK7vynVVIcgveC5KBJArHBAl5acXpLs3Khmx0ZEb+sErJA==
|
||||
lemmy-js-client@0.9.0-rc.12:
|
||||
version "0.9.0-rc.12"
|
||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.9.0-rc.12.tgz#991d31c4ef89b9bd4088a17c60b6cbaac997df41"
|
||||
integrity sha512-SeCw9wjU89Zm4YWhr+neHC2XvqoqzJg2e42sFEgcDmnQxpPt2sND9Udu+tjGXatbz0tCu6ybGmpR5M0QT4xx9Q==
|
||||
|
||||
leven@^3.1.0:
|
||||
version "3.1.0"
|
||||
|
|
Loading…
Reference in a new issue