Skip to content

Commit ca6f158

Browse files
committed
[Feature] Implement Community Kicked notification
1 parent 1e4a49f commit ca6f158

File tree

4 files changed

+48
-2
lines changed

4 files changed

+48
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
(ns status-im2.contexts.activity-center.notification.community-kicked.view
2+
(:require [quo2.core :as quo]
3+
[status-im2.contexts.activity-center.notification.common.style :as common-style]
4+
[status-im2.contexts.activity-center.notification.common.view :as common]
5+
[utils.datetime :as datetime]
6+
[utils.i18n :as i18n]
7+
[utils.re-frame :as rf]))
8+
9+
(defn- swipeable
10+
[{:keys [active-swipeable extra-fn]} child]
11+
[common/swipeable
12+
{:left-button common/swipe-button-read-or-unread
13+
:left-on-press common/swipe-on-press-toggle-read
14+
:right-button common/swipe-button-delete
15+
:right-on-press common/swipe-on-press-delete
16+
:active-swipeable active-swipeable
17+
:extra-fn extra-fn}
18+
child])
19+
20+
(defn view
21+
[{:keys [notification set-swipeable-height] :as props}]
22+
(let [{:keys [community-id read
23+
timestamp]} notification
24+
community (rf/sub [:communities/community community-id])
25+
community-name (:name community)
26+
community-image (get-in community [:images :thumbnail :uri])]
27+
[swipeable props
28+
[quo/activity-log
29+
{:title (i18n/label :t/community-kicked-heading)
30+
:icon :i/placeholder
31+
:on-layout set-swipeable-height
32+
:timestamp (datetime/timestamp->relative timestamp)
33+
:unread? (not read)
34+
:context [[quo/text {:style common-style/user-avatar-tag-text}
35+
(i18n/label :t/community-kicked-body)]
36+
[quo/context-tag common/tag-params {:uri community-image}
37+
community-name]]}]]))

src/status_im2/contexts/activity_center/notification_types.cljs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
(def ^:const contact-request 5)
99
(def ^:const community-request 7)
1010
(def ^:const admin 8)
11+
(def ^:const community-kicked 9)
1112
(def ^:const contact-verification 10)
1213

1314
(def ^:const all-supported
@@ -18,6 +19,7 @@
1819
contact-request
1920
community-request
2021
admin
22+
community-kicked
2123
contact-verification})
2224

2325
;; TODO: Replace with correct enum values once status-go implements them.
@@ -29,4 +31,5 @@
2931
it doesn't have a corresponding type in the backend. Think of the collection
3032
as a composite key of actual types."
3133
#{private-group-chat
32-
community-request})
34+
community-request
35+
community-kicked})

src/status_im2/contexts/activity_center/view.cljs

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
[status-im2.contexts.activity-center.notification.reply.view :as reply]
1515
[status-im2.contexts.activity-center.notification.community-request.view :as
1616
community-request]
17+
[status-im2.contexts.activity-center.notification.community-kicked.view :as
18+
community-kicked]
1719
[status-im2.contexts.activity-center.style :as style]
1820
[utils.i18n :as i18n]
1921
[utils.re-frame :as rf]
@@ -203,6 +205,8 @@
203205

204206
types/community-request [community-request/view props]
205207

208+
types/community-kicked [community-kicked/view props]
209+
206210
nil)
207211

208212
:else

translations/en.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2078,5 +2078,7 @@
20782078
"community-request-not-accepted-body-text-prefix": "Your request to join",
20792079
"community-request-not-accepted-body-text-suffix": "hasn't been accepted",
20802080
"community-request-pending": "Request pending",
2081-
"community-request-pending-body-text": "You requested to join"
2081+
"community-request-pending-body-text": "You requested to join",
2082+
"community-kicked-heading": "Kicked from community",
2083+
"community-kicked-body": "You were kicked from"
20822084
}

0 commit comments

Comments
 (0)