Skip to content

Commit

Permalink
compose: Add stream privacy decorations in banner box.
Browse files Browse the repository at this point in the history
compose: Add globe icon to web public stream in sent message notification banner.

compose: Fix vertical alignment and size of stream privacy decoration icons in banner box.

lint: Fix trailing whitespaces in static/styles/compose.css

lint: Fix white trailing whitespace in compose_notification.hbs

compose: Fix alignment of stream privacy icons in banner box.

compose: Add stream privacy decorations banner box.

lint: Fix linting errors.

lint: Fix lint error.

Empty commit to rerun Github Actions

node_tests: Removed get_invite_only node test.
  • Loading branch information
srdeotarse committed Jan 24, 2022
1 parent 35960be commit feff36f
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 11 deletions.
1 change: 1 addition & 0 deletions frontend_tests/node_tests/stream_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ test("basics", () => {
stream_data.get_stream_privacy_policy(denmark.stream_id),
"invite-only-public-history",
);

assert.equal(stream_data.get_stream_privacy_policy(web_public_stream.stream_id), "web-public");
assert.ok(stream_data.is_web_public_by_stream_name(web_public_stream.name));
assert.ok(!stream_data.is_web_public_by_stream_name(social.name));
Expand Down
34 changes: 26 additions & 8 deletions static/js/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,23 @@ export function is_window_focused() {
export function notify_above_composebox(
note,
link_class,
is_private_stream,
is_global_stream,
above_composebox_narrow_url,
link_msg_id,
link_text,
default_message,
message_recipient,
) {
const notification_html = $(
render_compose_notification({
note,
link_class,
is_private_stream,
is_global_stream,
above_composebox_narrow_url,
link_msg_id,
link_text,
default_message,
message_recipient,
}),
);
clear_compose_notifications();
Expand Down Expand Up @@ -618,6 +624,8 @@ export function notify_local_mixes(messages, need_user_to_scroll) {
let reason = get_local_notify_mix_reason(message);

const above_composebox_narrow_url = get_above_composebox_narrow_url(message);
const is_global_stream = stream_data.is_web_public_by_stream_name(message.stream);
const is_private_stream = stream_data.is_invite_only_by_stream_name(message.stream);

if (!reason) {
if (need_user_to_scroll) {
Expand All @@ -635,17 +643,21 @@ export function notify_local_mixes(messages, need_user_to_scroll) {

const link_msg_id = message.id;
const link_class = "compose_notification_narrow_by_topic";
const link_text = $t(
{defaultMessage: "Narrow to {message_recipient}"},
const default_message = $t({defaultMessage: "Narrow to "});
const message_recipient = $t(
{defaultMessage: "{message_recipient}"},
{message_recipient: get_message_header(message)},
);

notify_above_composebox(
reason,
link_class,
is_private_stream,
is_global_stream,
above_composebox_narrow_url,
link_msg_id,
link_text,
default_message,
message_recipient,
);
}
}
Expand All @@ -671,16 +683,22 @@ export function notify_messages_outside_current_search(messages) {
continue;
}
const above_composebox_narrow_url = get_above_composebox_narrow_url(message);
const link_text = $t(
{defaultMessage: "Narrow to {message_recipient}"},
const is_global_stream = stream_data.is_web_public_by_stream_name(message.stream);
const is_private_stream = stream_data.is_invite_only_by_stream_name(message.stream);
const default_message = $t({defaultMessage: "Narrow to "});
const message_recipient = $t(
{defaultMessage: "{message_recipient}"},
{message_recipient: get_message_header(message)},
);
notify_above_composebox(
$t({defaultMessage: "Sent! Your recent message is outside the current search."}),
"compose_notification_narrow_by_topic",
is_global_stream,
is_private_stream,
above_composebox_narrow_url,
message.id,
link_text,
default_message,
message_recipient,
);
}
}
Expand Down
17 changes: 16 additions & 1 deletion static/styles/compose.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@

#private-message .to_text {
vertical-align: middle;

font-weight: 600;
}

Expand Down Expand Up @@ -150,6 +149,22 @@
}
}

#compose-lock-icon,
.hashtag {
vertical-align: middle;
}

#compose-lock-icon,
#compose-globe-icon {
position: relative;
margin-left: 3px;
width: 0;
}

.hashtag {
margin-right: -2px;
}

#send_message_form {
margin: 0;
height: 100%;
Expand Down
26 changes: 24 additions & 2 deletions static/templates/compose_notification.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
{{! Content of sent-message notifications }}
<div class="compose-notifications-content">
{{note}} {{#if link_class}}<a href="{{above_composebox_narrow_url}}" class="{{link_class}}" data-message-id="{{link_msg_id}}">{{link_text}}</a>{{/if}}
<button type="button" class="out-of-view-notification-close close">&times;</button>
{{note}}
{{#if link_class}}
<a
href="{{above_composebox_narrow_url}}"
class="{{link_class}}"
data-message-id="{{link_msg_id}}"
>{{default_message}}
{{#if is_global_stream}}
<span id="compose-globe-icon">
<i class="fa fa-globe"></i>
</span>
{{else if is_private_stream}}
<span id="compose-lock-icon">
<i class="fa fa-lock"></i>
</span>
{{else}}
<span class="hashtag"></span>
{{/if}}
{{message_recipient}}</a>
{{/if}}
<button
type="button"
class="out-of-view-notification-close close"
>&times;</button>
</div>

0 comments on commit feff36f

Please sign in to comment.