Commit 5abb67e92e0a7e62bca89816bcd2e6de98f565a3
continue work on post visibility warnings
- coloured backgrounds on warning messages - display number of recps on private messagesMatt McKegg committed on 7/9/2018, 8:10:59 AM
Parent: 36bc8a5bc0831af40becbbabceb854e88650af06
Files changed
locales/en.json | changed |
modules/message/sheet/preview.js | changed |
modules/sheet/display.js | changed |
styles/dark/compose.mcss | changed |
styles/dark/sheet.mcss | changed |
styles/light/sheet.mcss | changed |
locales/en.json | ||
---|---|---|
@@ -210,12 +210,19 @@ | ||
210 | 210 | "OK": "OK", |
211 | 211 | "You have not made any changes.": "You have not made any changes.", |
212 | 212 | "Nothing to publish": "Nothing to publish", |
213 | 213 | "Edit Gathering": "Edit Gathering", |
214 | - "Only visible to you and people that have been mentioned": "Only visible to you and people that have been mentioned", | |
215 | - "Only visible to you and other thread participants": "Only visible to you and other thread participants", | |
216 | 214 | "This message will be public and cannot be edited or deleted": "This message will be public and cannot be edited or deleted", |
217 | 215 | "This message will be public and can be edited by anyone": "This message will be public and can be edited by anyone", |
216 | + "Only visible to you and %s people that have been mentioned": { | |
217 | + "one": "Only visible to you and one person that has been mentioned", | |
218 | + "other": "Only visible to you and %s people that have been mentioned" | |
219 | + }, | |
220 | + "Only visible to you and %s other thread participants": { | |
221 | + "one": "Only visible to you and one other thread participant", | |
222 | + "other": "Only visible to you and %s other thread participants" | |
223 | + }, | |
224 | + "This message will only be visible to you": "This message will only be visible to you", | |
218 | 225 | "Show details": "Show details", |
219 | 226 | "Hide details": "Hide details", |
220 | 227 | "%s people": { |
221 | 228 | "one": "%s person", |
modules/message/sheet/preview.js | ||
---|---|---|
@@ -5,34 +5,41 @@ | ||
5 | 5 | exports.needs = nest({ |
6 | 6 | 'sheet.display': 'first', |
7 | 7 | 'message.html.render': 'first', |
8 | 8 | 'intl.sync.i18n': 'first', |
9 | + 'intl.sync.i18n_n': 'first', | |
9 | 10 | 'emoji.sync.url': 'first' |
10 | 11 | }) |
11 | 12 | |
12 | 13 | exports.gives = nest('message.sheet.preview') |
13 | 14 | |
14 | 15 | exports.create = function (api) { |
15 | 16 | const i18n = api.intl.sync.i18n |
17 | + const plural = api.intl.sync.i18n_n | |
18 | + | |
16 | 19 | return nest('message.sheet.preview', function (msg, cb) { |
17 | 20 | api.sheet.display(function (close) { |
18 | 21 | var isPrivate = msg.value.private |
19 | 22 | var isRoot = !msg.value.content.root |
23 | + var recps = (msg.value.content.recps || []).filter(id => id !== msg.value.author) | |
20 | 24 | return { |
21 | 25 | content: [ |
22 | 26 | api.message.html.render(msg) |
23 | 27 | ], |
28 | + classList: [ | |
29 | + when(isPrivate, '-private', '-public') | |
30 | + ], | |
24 | 31 | footer: [ |
25 | 32 | when(isPrivate, |
26 | 33 | h('img', {src: api.emoji.sync.url('closed_lock_with_key')}), |
27 | 34 | h('img', {src: api.emoji.sync.url('globe_with_meridians')}) |
28 | 35 | ), |
29 | 36 | when(isPrivate, |
30 | 37 | h('div.info -private', [ |
31 | - when(isRoot, | |
32 | - i18n('Only visible to you and people that have been mentioned'), | |
33 | - i18n('Only visible to you and other thread participants') | |
34 | - ) | |
38 | + recps.length ? when(isRoot, | |
39 | + plural('Only visible to you and %s people that have been mentioned', recps.length), | |
40 | + plural('Only visible to you and %s other thread participants', recps.length) | |
41 | + ) : i18n('This message will only be visible to you') | |
35 | 42 | ]), |
36 | 43 | h('div.info -public', [ |
37 | 44 | when(msg.publicallyEditable, |
38 | 45 | i18n('This message will be public and can be edited by anyone'), |
modules/sheet/display.js | ||
---|---|---|
@@ -4,11 +4,11 @@ | ||
4 | 4 | exports.gives = nest('sheet.display') |
5 | 5 | |
6 | 6 | exports.create = function () { |
7 | 7 | return nest('sheet.display', function (handler) { |
8 | - var {content, footer} = handler(done) | |
8 | + var {content, footer, classList} = handler(done) | |
9 | 9 | |
10 | - var container = h('div', {className: 'Sheet'}, [ | |
10 | + var container = h('div', {className: 'Sheet', classList}, [ | |
11 | 11 | h('section', [content]), |
12 | 12 | h('footer', [footer]) |
13 | 13 | ]) |
14 | 14 |
styles/dark/compose.mcss | ||
---|---|---|
@@ -108,9 +108,9 @@ | ||
108 | 108 | } |
109 | 109 | |
110 | 110 | button { |
111 | 111 | :hover { |
112 | - background: #6f74e5 | |
112 | + background: #e56f6f | |
113 | 113 | } |
114 | 114 | -private { |
115 | 115 | :hover { |
116 | 116 | background: #ceab2f |
styles/dark/sheet.mcss | ||
---|---|---|
@@ -14,8 +14,21 @@ | ||
14 | 14 | display: flex |
15 | 15 | flex-direction: column |
16 | 16 | z-index: 50 |
17 | 17 | |
18 | + -private { | |
19 | + footer { | |
20 | + border-color: #5b56b3 | |
21 | + background-color: #372a56 | |
22 | + } | |
23 | + } | |
24 | + | |
25 | + -public { | |
26 | + footer { | |
27 | + background-color: #4a3232 | |
28 | + } | |
29 | + } | |
30 | + | |
18 | 31 | section { |
19 | 32 | overflow-y: auto |
20 | 33 | flex: 1 |
21 | 34 | } |
styles/light/sheet.mcss | ||
---|---|---|
@@ -15,8 +15,21 @@ | ||
15 | 15 | display: flex |
16 | 16 | flex-direction: column |
17 | 17 | z-index: 50 |
18 | 18 | |
19 | + -private { | |
20 | + footer { | |
21 | + background-color: #fffbf4 | |
22 | + } | |
23 | + } | |
24 | + | |
25 | + -public { | |
26 | + footer { | |
27 | + border-color: #c7c3ff; | |
28 | + background-color: #f4f4fd; | |
29 | + } | |
30 | + } | |
31 | + | |
19 | 32 | section { |
20 | 33 | overflow-y: auto |
21 | 34 | flex: 1 |
22 | 35 | } |
Built with git-ssb-web