]> Untitled Git - lemmy-ui.git/commitdiff
Expose pending 2 (#662)
authorDessalines <dessalines@users.noreply.github.com>
Thu, 23 Jun 2022 13:35:53 +0000 (09:35 -0400)
committerGitHub <noreply@github.com>
Thu, 23 Jun 2022 13:35:53 +0000 (13:35 +0000)
* Updating translations.

* Adding better subscribe type.

* Fix extra pending string.

package.json
src/shared/components/comment/comment-report.tsx
src/shared/components/community/communities.tsx
src/shared/components/community/sidebar.tsx
src/shared/components/post/post-report.tsx
yarn.lock

index f6ea01cb9ff3752998c4d11edbedb6f5c7c53cf5..a64332244c7b187ffb35aa2773a4b9ee0d03092b 100644 (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",
index 98668e763147d2490b55f454875b06f4876a3308..0a6522631b2e7b66d36eda0c3c59adaa6c32b79f 100644 (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,
index a9d4a6c1e84bde3081387d9941263122289decf9..0ed2787f10b2e23486b12e40c1fb464ac205a42a 100644 (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>
                     ))}
index 159080a1aba9184c8a62184af04040eecf7996ca..91c7ba8ff5b698faecb1e4df5900622d0b1139df 100644 (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="#"
index 18487613cc1138df56717ce44597ab7344e873ed..220a5a9eefab8082726b34d55159db7a4711cbc0 100644 (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,
index 2b2fba457256a86225394fd37a042ddcd819f26f..571c0a49b79d9cf7e8d594a1c6b66344d4ff6732 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -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"