-
Notifications
You must be signed in to change notification settings - Fork 990
[15902] BUGFIX - Resolve public keys into the user's name in the confirmation drawer #16176
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,87 +9,106 @@ | |
[utils.re-frame :as rf])) | ||
|
||
(defn render-inline | ||
[units {:keys [type literal destination]} chat-id] | ||
(case (keyword type) | ||
:code | ||
(conj units [quo/text {:style (merge style/block (style/code)) :weight :code} literal]) | ||
|
||
:emph | ||
(conj units [quo/text {:style {:font-style :italic}} literal]) | ||
|
||
:strong | ||
(conj units [quo/text {:weight :bold} literal]) | ||
|
||
:strong-emph | ||
(conj units | ||
[quo/text | ||
{:weight :bold | ||
:style {:font-style :italic}} literal]) | ||
|
||
:del | ||
(conj units [quo/text {:style {:text-decoration-line :line-through}} literal]) | ||
|
||
:link | ||
(conj units | ||
[quo/text | ||
{:style {:color (colors/theme-colors colors/primary-50 colors/primary-60)} | ||
:on-press #(rf/dispatch [:browser.ui/message-link-pressed destination])} | ||
destination]) | ||
|
||
:mention | ||
(conj | ||
units | ||
[rn/view | ||
{:style style/mention-tag-wrapper} | ||
[rn/touchable-opacity | ||
{:active-opacity 1 | ||
:on-press #(rf/dispatch [:chat.ui/show-profile literal]) | ||
:style style/mention-tag} | ||
[quo/text | ||
{:weight :medium | ||
:style style/mention-tag-text} | ||
(rf/sub [:messages/resolve-mention literal])]]]) | ||
|
||
:edited | ||
(conj units | ||
|
||
[quo/text | ||
{:weight :medium | ||
:style {:font-size 11 ; Font-size must be used instead of props or the | ||
; styles will clash with original message text | ||
:color (colors/theme-colors colors/neutral-40 | ||
colors/neutral-50)}} | ||
literal]) | ||
:status-tag | ||
(let [community-id (rf/sub [:community-id-by-chat-id chat-id])] | ||
[units {:keys [type literal destination]} chat-id style-override] | ||
(let [show-as-plain-text? (seq style-override)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this could just be the prop value instead, would be slightly nicer as you don't couple style override to this.
|
||
(case (keyword type) | ||
:code | ||
(conj units | ||
[quo/text | ||
{:style (if show-as-plain-text? | ||
{:color colors/white} | ||
(merge style/block (style/code))) | ||
:weight :code} literal]) | ||
|
||
:emph | ||
(conj units | ||
[quo/text | ||
{:style {:font-style :italic | ||
:color (when show-as-plain-text? colors/white)}} literal]) | ||
|
||
:strong | ||
(conj units | ||
[quo/text | ||
(cond-> {:weight :bold} | ||
show-as-plain-text? (assoc :style {:color colors/white})) literal]) | ||
|
||
:strong-emph | ||
(conj units | ||
[quo/text | ||
{:weight :bold | ||
:style {:font-style :italic | ||
:color (when show-as-plain-text? colors/white)}} literal]) | ||
|
||
:del | ||
(conj units | ||
[quo/text | ||
{:style {:text-decoration-line :line-through | ||
:color (when show-as-plain-text? colors/white)}} literal]) | ||
|
||
:link | ||
(conj units | ||
[quo/text | ||
{:style {:color (colors/theme-colors colors/primary-50 colors/primary-60)} | ||
:on-press #(rf/dispatch [:browser.ui/message-link-pressed destination])} | ||
destination]) | ||
|
||
:mention | ||
(conj | ||
units | ||
[rn/view | ||
{:style style/mention-tag-wrapper} | ||
[rn/touchable-opacity | ||
{:active-opacity 1 | ||
:on-press #(rf/dispatch [:chat.ui/show-profile literal]) | ||
:style style/mention-tag} | ||
[quo/text | ||
{:weight :medium | ||
:style style/mention-tag-text} | ||
(rf/sub [:messages/resolve-mention literal])]]]) | ||
|
||
:edited | ||
(conj units | ||
[rn/text | ||
(when community-id | ||
{:style {:color :blue | ||
:text-decoration-line :underline} | ||
:on-press #(rf/dispatch [:communities/status-tag-pressed community-id literal])}) | ||
"#" | ||
literal])) | ||
|
||
(conj units literal))) | ||
[quo/text | ||
{:weight :medium | ||
:style {:font-size 11 ; Font-size must be used instead of props or the | ||
; styles will clash with original message text | ||
:color (colors/theme-colors colors/neutral-40 | ||
colors/neutral-50)}} | ||
literal]) | ||
:status-tag | ||
(let [community-id (rf/sub [:community-id-by-chat-id chat-id])] | ||
(conj units | ||
[rn/text | ||
(when community-id | ||
{:style {:color :blue | ||
:text-decoration-line :underline} | ||
:on-press #(rf/dispatch [:communities/status-tag-pressed community-id literal])}) | ||
"#" | ||
literal])) | ||
|
||
(conj units literal)))) | ||
|
||
|
||
(defn render-block | ||
[blocks {:keys [type literal children]} chat-id] | ||
[blocks {:keys [type literal children]} chat-id style-override] | ||
ibrkhalil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
(case (keyword type) | ||
:paragraph | ||
(conj blocks | ||
(reduce | ||
(fn [acc e] | ||
(render-inline acc e chat-id)) | ||
[quo/text {:size :paragraph-1}] | ||
children)) | ||
[rn/view | ||
(reduce | ||
(fn [acc e] | ||
(render-inline acc e chat-id style-override)) | ||
[quo/text | ||
{:style {:size :paragraph-1 | ||
:color (when (seq style-override) colors/white)}}] | ||
children)]) | ||
|
||
:edited-block | ||
(conj blocks | ||
(reduce | ||
(fn [acc e] | ||
(render-inline acc e chat-id)) | ||
(render-inline acc e chat-id style-override)) | ||
[quo/text {:size :paragraph-1}] | ||
children)) | ||
|
||
|
@@ -120,11 +139,11 @@ | |
(conj parsed-text {:type :edited-block :children [edited-tag]})))) | ||
|
||
(defn render-parsed-text | ||
[{:keys [content chat-id edited-at]}] | ||
[{:keys [content chat-id edited-at style-override]}] | ||
^{:key (:parsed-text content)} | ||
[rn/view | ||
[rn/view {:style style-override} | ||
(reduce (fn [acc e] | ||
(render-block acc e chat-id)) | ||
(render-block acc e chat-id style-override)) | ||
[:<>] | ||
(cond-> (:parsed-text content) | ||
edited-at | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the kind of thing we should have a subscription for, so that we can avoid code duplication to handle the logic for display names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we either add this as part of this pr, or create a follow up issue so it can be addressed?