MCPcopy Create free account
hub / github.com/mailvelope/mailvelope / getKeyServerSyncAlert

Method getKeyServerSyncAlert

src/app/keyring/User.js:225–278  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

223 }
224
225 getKeyServerSyncAlert() {
226 let data;
227 if (!this.state.syncAction) {
228 if (this.state.user.remote) {
229 if (this.state.user.verified) {
230 data = {
231 type: 'success',
232 text: l10n.map.user_keyserver_sync
233 };
234 } else {
235 data = {
236 type: 'warning',
237 text: l10n.map.user_keyserver_unverified,
238 btnText: l10n.map.user_keyserver_resend_confirmation_btn,
239 handler: {sync: true}
240 };
241 }
242 } else {
243 data = {
244 type: 'danger',
245 text: l10n.map.user_keyserver_not,
246 btnText: l10n.map.key_keyserver_upload_btn,
247 handler: {sync: true}
248 };
249 }
250 } else {
251 if (this.state.syncAction === 'upload') {
252 data = {
253 type: 'warning',
254 text: l10n.get('user_keyserver_upload', this.state.user.email),
255 btnText: l10n.map.key_keyserver_resend_btn,
256 handler: {sync: true}
257 };
258 } else {
259 data = {
260 type: 'warning',
261 text: l10n.get('user_keyserver_remove', this.state.user.email),
262 btnText: l10n.map.key_keyserver_resend_btn,
263 handler: {sync: false}
264 };
265 }
266 }
267 return (
268 <Alert type={data.type}>
269 <div className="d-flex align-items-center">
270 <span className="flex-shrink-1 mr-4">{data.text}</span>
271 <div className="btn-bar flex-md-shrink-0 flex-grow-1">
272 {(this.state.keyDetails.validity && data.btnText && (this.state.user.remote || this.state.user.status === PGP_KEYSTATUS_VALID)) && <button type="button" onClick={() => this.handleKeyServerSync(data.handler)} className="btn btn-secondary mb-md-0">{data.btnText}</button>}
273 {(this.state.user.remote && !this.state.syncAction) && <button type="button" onClick={() => this.handleKeyServerSync({sync: false})} className="btn btn-secondary mb-md-0">{l10n.map.user_keyserver_remove_btn}</button>}
274 </div>
275 </div>
276 </Alert>
277 );
278 }
279
280 render() {
281 if (this.state.exit) {

Callers 1

User.jsFile · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected