Merge branch 'dev'
This commit is contained in:
commit
1419ae9882
17 changed files with 40 additions and 24 deletions
|
@ -161,9 +161,27 @@ impl Perform<LoginResponse> for Oper<Register> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Create the main community if it doesn't exist
|
||||||
|
let main_community: Community = match Community::read_from_name(&conn, "main".to_string()) {
|
||||||
|
Ok(c) => c,
|
||||||
|
Err(_e) => {
|
||||||
|
let community_form = CommunityForm {
|
||||||
|
name: "main".to_string(),
|
||||||
|
title: "The Default Community".to_string(),
|
||||||
|
description: Some("The Default Community".to_string()),
|
||||||
|
category_id: 1,
|
||||||
|
creator_id: inserted_user.id,
|
||||||
|
removed: None,
|
||||||
|
deleted: None,
|
||||||
|
updated: None,
|
||||||
|
};
|
||||||
|
Community::create(&conn, &community_form).unwrap()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Sign them up for main community no matter what
|
// Sign them up for main community no matter what
|
||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: 1,
|
community_id: main_community.id,
|
||||||
user_id: inserted_user.id,
|
user_id: inserted_user.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -177,7 +195,7 @@ impl Perform<LoginResponse> for Oper<Register> {
|
||||||
// If its an admin, add them as a mod and follower to main
|
// If its an admin, add them as a mod and follower to main
|
||||||
if data.admin {
|
if data.admin {
|
||||||
let community_moderator_form = CommunityModeratorForm {
|
let community_moderator_form = CommunityModeratorForm {
|
||||||
community_id: 1,
|
community_id: main_community.id,
|
||||||
user_id: inserted_user.id,
|
user_id: inserted_user.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.title = "Communities - Lemmy";
|
document.title = `Communities - ${WebSocketService.Instance.site.name}`;
|
||||||
let table = document.querySelector('#community_table');
|
|
||||||
Sortable.initTable(table);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Necessary for back button for some reason
|
// Necessary for back button for some reason
|
||||||
|
@ -176,6 +174,8 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
this.state.loading = false;
|
this.state.loading = false;
|
||||||
window.scrollTo(0,0);
|
window.scrollTo(0,0);
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
|
let table = document.querySelector('#community_table');
|
||||||
|
Sortable.initTable(table);
|
||||||
} else if (op == UserOperation.FollowCommunity) {
|
} else if (op == UserOperation.FollowCommunity) {
|
||||||
let res: CommunityResponse = msg;
|
let res: CommunityResponse = msg;
|
||||||
let found = this.state.communities.find(c => c.id == res.community.id);
|
let found = this.state.communities.find(c => c.id == res.community.id);
|
||||||
|
|
|
@ -200,7 +200,7 @@ export class Community extends Component<any, State> {
|
||||||
this.state.community = res.community;
|
this.state.community = res.community;
|
||||||
this.state.moderators = res.moderators;
|
this.state.moderators = res.moderators;
|
||||||
this.state.admins = res.admins;
|
this.state.admins = res.admins;
|
||||||
document.title = `/c/${this.state.community.name} - Lemmy`;
|
document.title = `/c/${this.state.community.name} - ${WebSocketService.Instance.site.name}`;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
this.fetchPosts();
|
this.fetchPosts();
|
||||||
} else if (op == UserOperation.EditCommunity) {
|
} else if (op == UserOperation.EditCommunity) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component } from 'inferno';
|
import { Component } from 'inferno';
|
||||||
import { CommunityForm } from './community-form';
|
import { CommunityForm } from './community-form';
|
||||||
import { Community } from '../interfaces';
|
import { Community } from '../interfaces';
|
||||||
|
import { WebSocketService } from '../services';
|
||||||
|
|
||||||
export class CreateCommunity extends Component<any, any> {
|
export class CreateCommunity extends Component<any, any> {
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ export class CreateCommunity extends Component<any, any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.title = "Create Community - Lemmy";
|
document.title = `Create Community - ${WebSocketService.Instance.site.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Component } from 'inferno';
|
import { Component } from 'inferno';
|
||||||
import { PostForm } from './post-form';
|
import { PostForm } from './post-form';
|
||||||
|
import { WebSocketService } from '../services';
|
||||||
|
|
||||||
export class CreatePost extends Component<any, any> {
|
export class CreatePost extends Component<any, any> {
|
||||||
|
|
||||||
|
@ -9,7 +10,7 @@ export class CreatePost extends Component<any, any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.title = "Create Post - Lemmy";
|
document.title = `Create Post - ${WebSocketService.Instance.site.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -49,7 +49,7 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.title = `/u/${UserService.Instance.user.username} Inbox - Lemmy`;
|
document.title = `/u/${UserService.Instance.user.username} Inbox - ${WebSocketService.Instance.site.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class Login extends Component<any, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.title = "Login - Lemmy";
|
document.title = `Login - ${WebSocketService.Instance.site.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -101,10 +101,6 @@ export class Main extends Component<any, MainState> {
|
||||||
this.subscription.unsubscribe();
|
this.subscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
document.title = "Lemmy";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Necessary for back button for some reason
|
// Necessary for back button for some reason
|
||||||
componentWillReceiveProps(nextProps: any) {
|
componentWillReceiveProps(nextProps: any) {
|
||||||
if (nextProps.history.action == 'POP') {
|
if (nextProps.history.action == 'POP') {
|
||||||
|
@ -377,6 +373,8 @@ export class Main extends Component<any, MainState> {
|
||||||
this.state.site.site = res.site;
|
this.state.site.site = res.site;
|
||||||
this.state.site.banned = res.banned;
|
this.state.site.banned = res.banned;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
|
document.title = `${WebSocketService.Instance.site.name}`;
|
||||||
|
|
||||||
} else if (op == UserOperation.EditSite) {
|
} else if (op == UserOperation.EditSite) {
|
||||||
let res: SiteResponse = msg;
|
let res: SiteResponse = msg;
|
||||||
this.state.site.site = res.site;
|
this.state.site.site = res.site;
|
||||||
|
|
|
@ -45,7 +45,7 @@ export class Modlog extends Component<any, ModlogState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.title = "Modlog - Lemmy";
|
document.title = `Modlog - ${WebSocketService.Instance.site.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
setCombined(res: GetModlogResponse) {
|
setCombined(res: GetModlogResponse) {
|
||||||
|
|
|
@ -253,7 +253,7 @@ export class Post extends Component<any, PostState> {
|
||||||
this.state.moderators = res.moderators;
|
this.state.moderators = res.moderators;
|
||||||
this.state.admins = res.admins;
|
this.state.admins = res.admins;
|
||||||
this.state.loading = false;
|
this.state.loading = false;
|
||||||
document.title = `${this.state.post.name} - Lemmy`;
|
document.title = `${this.state.post.name} - ${WebSocketService.Instance.site.name}`;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
} else if (op == UserOperation.CreateComment) {
|
} else if (op == UserOperation.CreateComment) {
|
||||||
let res: CommentResponse = msg;
|
let res: CommentResponse = msg;
|
||||||
|
|
|
@ -52,7 +52,7 @@ export class Search extends Component<any, SearchState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.title = "Search - Lemmy";
|
document.title = `Search - ${WebSocketService.Instance.site.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -250,7 +250,7 @@ export class Search extends Component<any, SearchState> {
|
||||||
let res: SearchResponse = msg;
|
let res: SearchResponse = msg;
|
||||||
this.state.searchResponse = res;
|
this.state.searchResponse = res;
|
||||||
this.state.loading = false;
|
this.state.loading = false;
|
||||||
document.title = `Search - ${this.state.q} - Lemmy`;
|
document.title = `Search - ${this.state.q} - ${WebSocketService.Instance.site.name}`;
|
||||||
window.scrollTo(0,0);
|
window.scrollTo(0,0);
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Component } from 'inferno';
|
import { Component } from 'inferno';
|
||||||
|
import { WebSocketService } from '../services';
|
||||||
|
|
||||||
let general =
|
let general =
|
||||||
[
|
[
|
||||||
|
@ -17,7 +18,7 @@ export class Sponsors extends Component<any, any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.title = "Sponsors - Lemmy";
|
document.title = `Sponsors - ${WebSocketService.Instance.site.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -341,7 +341,7 @@ export class User extends Component<any, UserState> {
|
||||||
this.state.moderates = res.moderates;
|
this.state.moderates = res.moderates;
|
||||||
this.state.posts = res.posts;
|
this.state.posts = res.posts;
|
||||||
this.state.loading = false;
|
this.state.loading = false;
|
||||||
document.title = `/u/${this.state.user.name} - Lemmy`;
|
document.title = `/u/${this.state.user.name} - ${WebSocketService.Instance.site.name}`;
|
||||||
window.scrollTo(0,0);
|
window.scrollTo(0,0);
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
} else if (op == UserOperation.EditComment) {
|
} else if (op == UserOperation.EditComment) {
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<link rel="shortcut icon" type="image/svg+xml" href="/static/assets/favicon.svg" />
|
<link rel="shortcut icon" type="image/svg+xml" href="/static/assets/favicon.svg" />
|
||||||
<link rel="apple-touch-icon" href="/static/assets/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" href="/static/assets/apple-touch-icon.png" />
|
||||||
<title>Lemmy</title>
|
|
||||||
<link rel="stylesheet" href="/static/assets/libs/balloon-css/balloon.min.css">
|
<link rel="stylesheet" href="/static/assets/libs/balloon-css/balloon.min.css">
|
||||||
<script src="/static/assets/libs/sortable/sortable.min.js"></script>
|
<script src="/static/assets/libs/sortable/sortable.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -16,7 +16,6 @@ export class UserService {
|
||||||
} else {
|
} else {
|
||||||
console.log('No JWT cookie found.');
|
console.log('No JWT cookie found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public login(res: LoginResponse) {
|
public login(res: LoginResponse) {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import { UserService } from './';
|
||||||
export class WebSocketService {
|
export class WebSocketService {
|
||||||
private static _instance: WebSocketService;
|
private static _instance: WebSocketService;
|
||||||
public subject: Subject<any>;
|
public subject: Subject<any>;
|
||||||
public instanceName: string;
|
|
||||||
|
|
||||||
public site: Site;
|
public site: Site;
|
||||||
public admins: Array<UserView>;
|
public admins: Array<UserView>;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export let version: string = "v0.0.5-16-gc7d8d5f";
|
export let version: string = "v0.0.6-0-g27b108a";
|
Reference in a new issue