Expose pending 2 (#662)

* Updating translations.

* Adding better subscribe type.

* Fix extra pending string.
This commit is contained in:
Dessalines 2022-06-23 09:35:53 -04:00 committed by GitHub
parent d905c91e1b
commit 46c610990a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 13 deletions

View file

@ -77,7 +77,7 @@
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.4",
"import-sort-style-module": "^6.0.0",
"lemmy-js-client": "0.17.0-rc.30",
"lemmy-js-client": "0.17.0-rc.31",
"lint-staged": "^12.4.1",
"mini-css-extract-plugin": "^2.6.0",
"node-fetch": "^2.6.1",

View file

@ -5,6 +5,7 @@ import {
CommentReportView,
CommentView,
ResolveCommentReport,
SubscribedType,
} from "lemmy-js-client";
import { i18n } from "../../i18next";
import { CommentNode as CommentNodeI } from "../../interfaces";
@ -40,7 +41,7 @@ export class CommentReport extends Component<CommentReportProps, any> {
community: r.community,
creator_banned_from_community: r.creator_banned_from_community,
counts: r.counts,
subscribed: false,
subscribed: SubscribedType.NotSubscribed,
saved: false,
creator_blocked: false,
recipient: None,

View file

@ -8,6 +8,7 @@ import {
ListCommunitiesResponse,
ListingType,
SortType,
SubscribedType,
UserOperation,
wsJsonToRes,
wsUserOp,
@ -183,7 +184,7 @@ export class Communities extends Component<any, CommunitiesState> {
{numToSI(cv.counts.comments)}
</td>
<td class="text-right">
{cv.subscribed ? (
{cv.subscribed == SubscribedType.Subscribed && (
<button
class="btn btn-link d-inline-block"
onClick={linkEvent(
@ -193,7 +194,8 @@ export class Communities extends Component<any, CommunitiesState> {
>
{i18n.t("unsubscribe")}
</button>
) : (
)}
{cv.subscribed == SubscribedType.NotSubscribed && (
<button
class="btn btn-link d-inline-block"
onClick={linkEvent(
@ -204,6 +206,11 @@ export class Communities extends Component<any, CommunitiesState> {
{i18n.t("subscribe")}
</button>
)}
{cv.subscribed == SubscribedType.Pending && (
<div class="text-warning d-inline-block">
{i18n.t("subscribe_pending")}
</div>
)}
</td>
</tr>
))}

View file

@ -9,6 +9,7 @@ import {
FollowCommunity,
PersonViewSafe,
RemoveCommunity,
SubscribedType,
toUndefined,
} from "lemmy-js-client";
import { i18n } from "../../i18next";
@ -111,7 +112,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
<BannerIconHeader icon={community.icon} banner={community.banner} />
)}
<span class="mr-2">{community.title}</span>
{subscribed && (
{subscribed == SubscribedType.Subscribed && (
<a
class="btn btn-secondary btn-sm mr-2"
href="#"
@ -121,6 +122,11 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
{i18n.t("joined")}
</a>
)}
{subscribed == SubscribedType.Pending && (
<div class="badge badge-warning mr-2">
{i18n.t("subscribe_pending")}
</div>
)}
{community.removed && (
<small className="mr-2 text-muted font-italic">
{i18n.t("removed")}
@ -257,7 +263,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
createPost() {
let cv = this.props.community_view;
return (
cv.subscribed && (
cv.subscribed == SubscribedType.Subscribed && (
<Link
className={`btn btn-secondary btn-block mb-2 ${
cv.community.deleted || cv.community.removed ? "no-click" : ""
@ -274,7 +280,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
let community_view = this.props.community_view;
return (
<div class="mb-2">
{!community_view.subscribed && (
{community_view.subscribed == SubscribedType.NotSubscribed && (
<a
class="btn btn-secondary btn-block"
href="#"

View file

@ -1,7 +1,12 @@
import { None } from "@sniptt/monads";
import { Component, linkEvent } from "inferno";
import { T } from "inferno-i18next-dess";
import { PostReportView, PostView, ResolvePostReport } from "lemmy-js-client";
import {
PostReportView,
PostView,
ResolvePostReport,
SubscribedType,
} from "lemmy-js-client";
import { i18n } from "../../i18next";
import { WebSocketService } from "../../services";
import { auth, wsClient } from "../../utils";
@ -35,7 +40,7 @@ export class PostReport extends Component<PostReportProps, any> {
community: r.community,
creator_banned_from_community: r.creator_banned_from_community,
counts: r.counts,
subscribed: false,
subscribed: SubscribedType.NotSubscribed,
saved: false,
read: false,
creator_blocked: false,

View file

@ -4948,10 +4948,10 @@ lcid@^1.0.0:
dependencies:
invert-kv "^1.0.0"
lemmy-js-client@0.17.0-rc.30:
version "0.17.0-rc.30"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.30.tgz#91cc926e662a5cd27f87cd2e6cdfcd210176745a"
integrity sha512-AcG8IZNNTa54BAXEqsL/QNlyPPwLntRLWpIOw9S3u84824d5inL7UCKnyx0UMbQklUuH/D3E2K9WNmZiUdvr3A==
lemmy-js-client@0.17.0-rc.31:
version "0.17.0-rc.31"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.31.tgz#373ad2dcbb1305bd82e7fb13704fbdb8d2f1c438"
integrity sha512-hcjFcOxgplffQullf9HuAGv2ko9wWySrnv+s8FWPPpg4EsixuBjXI+Dh7y0GR/KVs6fRmeXn4YBhR2YdJsBc7A==
levn@^0.4.1:
version "0.4.1"