Skip to content

Commit

Permalink
Merge branch 'master' into releases
Browse files Browse the repository at this point in the history
  • Loading branch information
taoeffect committed Jun 25, 2024
2 parents 5484805 + 5d5a75b commit b19ce8e
Show file tree
Hide file tree
Showing 21 changed files with 74,888 additions and 79 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ module.exports = (grunt) => {
minifySyntax: production,
minifyWhitespace: production,
outdir: distJS,
sourcemap: development,
sourcemap: true,
// Warning: split mode has still a few issues. See https://github.com/okTurtles/group-income/pull/1196
splitting: !grunt.option('no-chunks'),
watch: false // Not using esbuild's own watch mode since it involves polling.
Expand Down
7,825 changes: 7,825 additions & 0 deletions contracts/0.5.5/chatroom-slim.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions contracts/0.5.5/chatroom.0.5.5.manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"head":"{\"manifestVersion\":\"1.0.0\"}","body":"{\"name\":\"gi.contracts/chatroom\",\"version\":\"0.5.5\",\"contract\":{\"hash\":\"z9brRu3VQskhDbpUpSmiDBMChcigG1m1iTd1dLEjsUnAKugxxXDM\",\"file\":\"chatroom.js\"},\"signingKeys\":[\"[\\\"edwards25519sha512batch\\\",\\\"IjAFp6gIzHW2HOIXXS9b4A3EKf8t9NNa5nndHcROiDk=\\\",null]\"],\"contractSlim\":{\"file\":\"chatroom-slim.js\",\"hash\":\"z9brRu3VGtzYPrmJAR8rrqPbvnxE8LoohKxVpjNrNtAMjwxxWnNe\"}}","signature":{"keyId":"z2DrjgbCDg34SaBhFjNEF45AVodCUu7QwcFBksz3BDgN4BekrdN","value":"d3Kl8TWGYnchvWybvyrWF0H6mRm3MBRxBrvPpuCi73gJ1f4Opr4Kbf+ikBjoteVPwcarTmyKLdnaiH7dKVtMAQ=="}}
16,643 changes: 16,643 additions & 0 deletions contracts/0.5.5/chatroom.js

Large diffs are not rendered by default.

9,025 changes: 9,025 additions & 0 deletions contracts/0.5.5/group-slim.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions contracts/0.5.5/group.0.5.5.manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"head":"{\"manifestVersion\":\"1.0.0\"}","body":"{\"name\":\"gi.contracts/group\",\"version\":\"0.5.5\",\"contract\":{\"hash\":\"z9brRu3VNdaFTHNWqFsyvjVPMi7nA7ENyf2NF2QVrsxZevsS4RRK\",\"file\":\"group.js\"},\"signingKeys\":[\"[\\\"edwards25519sha512batch\\\",\\\"IjAFp6gIzHW2HOIXXS9b4A3EKf8t9NNa5nndHcROiDk=\\\",null]\"],\"contractSlim\":{\"file\":\"group-slim.js\",\"hash\":\"z9brRu3VTXnbXLZX72NxECZXMkKTequcKceBwXfqWiAwkZdszc58\"}}","signature":{"keyId":"z2DrjgbCDg34SaBhFjNEF45AVodCUu7QwcFBksz3BDgN4BekrdN","value":"bWTm3BUf3URiJ/LEiUvA8n8r30g5zMkre2IlEDbXk7F1JvvwOMbhpVo/iMq2BNFhZWXIgU9TysGTweXzrJ3XDw=="}}
17,854 changes: 17,854 additions & 0 deletions contracts/0.5.5/group.js

Large diffs are not rendered by default.

7,269 changes: 7,269 additions & 0 deletions contracts/0.5.5/identity-slim.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions contracts/0.5.5/identity.0.5.5.manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"head":"{\"manifestVersion\":\"1.0.0\"}","body":"{\"name\":\"gi.contracts/identity\",\"version\":\"0.5.5\",\"contract\":{\"hash\":\"z9brRu3VSnU2hBVkgsZtrYGSH82v4b6aYrJ1FscYsDFSNwBWnUHJ\",\"file\":\"identity.js\"},\"signingKeys\":[\"[\\\"edwards25519sha512batch\\\",\\\"IjAFp6gIzHW2HOIXXS9b4A3EKf8t9NNa5nndHcROiDk=\\\",null]\"],\"contractSlim\":{\"file\":\"identity-slim.js\",\"hash\":\"z9brRu3VPYGaiYhWjCDKEn4at4SJyUCLNqBfZAHJY5QmJSJ42gJv\"}}","signature":{"keyId":"z2DrjgbCDg34SaBhFjNEF45AVodCUu7QwcFBksz3BDgN4BekrdN","value":"jWw0vkuNDUhSbnvQF+PmHspDz6Q1tjLVART32es80D8FL/4qWGL5FoxoWEuj7X0uSApLN0iL1Ex/ktIExKfaAg=="}}
16,089 changes: 16,089 additions & 0 deletions contracts/0.5.5/identity.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions frontend/model/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ const getters = {
Object.keys(state.contracts)
.filter(contractID => state.contracts[contractID].type === 'gi.contracts/identity')
.forEach(contractID => {
if (!state[contractID]) {
console.warn('[ourContactProfilesById] Missing state', contractID)
return
}
const attributes = state[contractID].attributes
if (attributes) { // NOTE: this is for fixing the error while syncing the identity contracts
const username = checkedUsername(state, attributes.username, contractID)
Expand Down
14 changes: 10 additions & 4 deletions frontend/views/containers/chatroom/CreatePoll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
@click='onBackDropClick'
@keyup.esc='close'
)
.c-create-poll-wrapper(:style='this.ephemeral.isDesktopScreen ? this.ephemeral.wrapperPosition : {}')
.c-create-poll-wrapper(
data-test='createPollWrapper'
:style='this.ephemeral.isDesktopScreen ? this.ephemeral.wrapperPosition : {}'
)
header.c-header
i18n.is-title-2.c-popup-title(tag='h2') New poll
modal-close.c-popup-close-btn(v-if='!ephemeral.isDesktopScreen' @close='close')

section.c-body
form.c-form(@submit.prevent='' :disabled='form.disabled')
.field
.field(data-test='question')
input.input.c-input(
name='question'
ref='question'
Expand All @@ -22,7 +25,7 @@
v-error:question=''
)

.field.c-add-options
.field.c-add-options(data-test='options')
i18n.label Add options

.c-option-list(ref='optList')
Expand All @@ -46,13 +49,14 @@

button.link.has-icon(
v-if='enableMoreButton'
data-test='addOption'
type='button'
@click='addOption'
)
i.icon-plus
i18n Add more

label.field
label.field(data-test='expiration')
i18n.label Expires after (days)
.selectbox
select.select.c-duration-select(
Expand Down Expand Up @@ -81,6 +85,7 @@
.buttons.c-btns-container(:class='{ "is-vertical": ephemeral.isDesktopScreen }')
i18n.is-outlined(
:class='{ "is-small": ephemeral.isDesktopScreen }'
data-test='cancel'
tag='button'
type='button'
@click='close'
Expand All @@ -89,6 +94,7 @@
i18n(
:disabled='disableSubmit'
:class='{ "is-small": ephemeral.isDesktopScreen }'
data-test='submit'
tag='button'
type='button'
@click='submit'
Expand Down
7 changes: 4 additions & 3 deletions frontend/views/containers/chatroom/MessageActions.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang='pug'>
menu-parent(ref='menu')
menu-parent.c-message-menu(ref='menu')
.c-actions
tooltip(
direction='top'
Expand Down Expand Up @@ -164,10 +164,11 @@ export default ({
return this.isText || this.isPoll
},
isEditable () {
return this.isMsgSender && (this.isText || this.isPoll)
return this.isMsgSender && this.isText
},
isDeletable () {
return this.isEditable || this.isGroupCreator
return this.isGroupCreator ||
(this.isMsgSender && (this.isText || this.isPoll))
}
},
methods: {
Expand Down
11 changes: 2 additions & 9 deletions frontend/views/containers/chatroom/MessageBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ import SendArea from './SendArea.vue'
import ChatAttachmentPreview from './file-attachment/ChatAttachmentPreview.vue'
import { humanDate } from '@model/contracts/shared/time.js'
import { swapMentionIDForDisplayname } from '@model/contracts/shared/functions.js'
import {
MESSAGE_TYPES,
MESSAGE_VARIANTS
} from '@model/contracts/shared/constants.js'
import { MESSAGE_VARIANTS } from '@model/contracts/shared/constants.js'
import { OPEN_TOUCH_LINK_HELPER } from '@utils/events.js'
import { L, LTags } from '@common/common.js'
Expand Down Expand Up @@ -201,11 +198,7 @@ export default ({
humanDate,
swapMentionIDForDisplayname,
editMessage () {
if (this.type === MESSAGE_TYPES.POLL) {
alert('TODO: implement editting a poll')
} else {
this.isEditing = true
}
this.isEditing = true
},
onMessageEdited (newMessage) {
this.isEditing = false
Expand Down
26 changes: 14 additions & 12 deletions frontend/views/containers/chatroom/SendArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
)
button.is-icon(
:aria-label='L("Bold style text")'
@mousedown='transformTextSelectionToMarkdown($event, "bold")'
@mousedown.prevent='transformTextSelectionToMarkdown("bold")'
)
i.icon-bold
tooltip(
Expand All @@ -109,7 +109,7 @@
)
button.is-icon(
:aria-label='L("Italic style text")'
@mousedown='transformTextSelectionToMarkdown($event, "italic")'
@mousedown.prevent='transformTextSelectionToMarkdown("italic")'
)
i.icon-italic
tooltip(
Expand All @@ -119,7 +119,7 @@
)
button.is-icon(
:aria-label='L("Add code")'
@mousedown='transformTextSelectionToMarkdown($event, "code")'
@mousedown.prevent='transformTextSelectionToMarkdown("code")'
)
i.icon-code
tooltip(
Expand All @@ -129,7 +129,7 @@
)
button.is-icon(
:aria-label='L("Add strikethrough")'
@mousedown='transformTextSelectionToMarkdown($event, "strikethrough")'
@mousedown.prevent='transformTextSelectionToMarkdown("strikethrough")'
)
i.icon-strikethrough
tooltip(
Expand All @@ -139,7 +139,7 @@
)
button.is-icon(
:aria-label='L("Add link")'
@mousedown='transformTextSelectionToMarkdown($event, "link")'
@mousedown.prevent='transformTextSelectionToMarkdown("link")'
)
i.icon-link

Expand All @@ -163,7 +163,7 @@
)
button.is-icon(
:aria-label='L("Bold style text")'
@mousedown='transformTextSelectionToMarkdown($event, "bold")'
@mousedown.prevent='transformTextSelectionToMarkdown("bold")'
)
i.icon-bold
tooltip(
Expand All @@ -173,7 +173,7 @@
)
button.is-icon(
:aria-label='L("Italic style text")'
@mousedown='transformTextSelectionToMarkdown($event, "italic")'
@mousedown.prevent='transformTextSelectionToMarkdown("italic")'
)
i.icon-italic
tooltip(
Expand All @@ -183,7 +183,7 @@
)
button.is-icon(
:aria-label='L("Add code")'
@mousedown='transformTextSelectionToMarkdown($event, "code")'
@mousedown.prevent='transformTextSelectionToMarkdown("code")'
)
i.icon-code
tooltip(
Expand All @@ -193,7 +193,7 @@
)
button.is-icon(
:aria-label='L("Add strikethrough")'
@mousedown='transformTextSelectionToMarkdown($event, "strikethrough")'
@mousedown.prevent='transformTextSelectionToMarkdown("strikethrough")'
)
i.icon-strikethrough
tooltip(
Expand All @@ -203,7 +203,7 @@
)
button.is-icon(
:aria-label='L("Add link")'
@mousedown='transformTextSelectionToMarkdown($event, "link")'
@mousedown.prevent='transformTextSelectionToMarkdown("link")'
)
i.icon-link

Expand All @@ -214,6 +214,7 @@
:text='L("Create poll")'
)
button.is-icon(
data-test='createPoll'
:aria-label='L("Create poll")'
@click='openCreatePollModal'
)
Expand Down Expand Up @@ -808,8 +809,9 @@ export default ({
this.endMention()
}
},
transformTextSelectionToMarkdown (e, type) {
e.preventDefault() // Calling e.preventDefault() in 'mousedown' event listener prevents the button from being focused upon click.
transformTextSelectionToMarkdown (type) {
// NOTE: should call preventDefault() for 'mousedown' event
// to prevents the button from being focused upon click
const prevFocusElement = document.activeElement // the captured activeElement inside 'mousedown' handler is still a previously focused element.
const inputEl = this.$refs.textarea
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,10 @@ form(@submit.prevent='')

.buttons.c-buttons-container
template(v-if='enableSubmitBtn')
button-submit.is-small(
v-if='isChangeMode'
type='button'
@click='changeVotes'
)
button-submit.is-small(v-if='isChangeMode' data-test='submit' type='button' @click='changeVotes')
i18n Change vote

button-submit.is-small(
v-else
type='button'
@click='submitVotes'
)
button-submit.is-small(v-else type='button' data-test='submit' @click='submitVotes')
i18n Submit

i18n.is-small.is-outlined(v-if='isChangeMode' tag='button' type='button' @click='onCancelClick') Cancel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
i.icon-ellipsis-v
menu-content.c-poll-menu-content
ul
menu-item(tag='button' icon='edit' @click='$emit("request-vote-change")')
menu-item(tag='button' data-test='changeVote' icon='edit' @click='$emit("request-vote-change")')
i18n Change vote
.c-options-and-voters
ul.c-options-list
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "group-income",
"version": "0.5.4",
"contractsVersion": "0.5.4",
"version": "0.5.5",
"contractsVersion": "0.5.5",
"private": true,
"description": "",
"scripts": {
Expand Down
17 changes: 10 additions & 7 deletions shared/domains/chelonia/internals.js
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,10 @@ export default (sbp('sbp/selectors/register', {
}
if (!this.config.skipActionProcessing && !this.manifestToContract[manifestHash]) {
const rootState = sbp(this.config.stateSelector)
const contractName = has(rootState.contracts, contractID)
// Having rootState.contracts[contractID] is not enough to determine we
// have previously synced this contract, as reference counts are also
// stored there. Hence, we check for the presence of 'type'
const contractName = has(rootState.contracts, contractID) && has(rootState.contracts[contractID], 'type')
? rootState.contracts[contractID].type
: opT === GIMessage.OP_CONTRACT
? ((opV: any): GIOpContract).type
Expand Down Expand Up @@ -1304,15 +1307,15 @@ export default (sbp('sbp/selectors/register', {
const keysToUpdate = []

pendingWatch.forEach(([keyName, externalId]) => {
// Does the key exist? If not, it has probably been removed and instead
// of waiting, we need to remove it ourselves
// Does the key exist? If not, it has probably been removed and instead
// of waiting, we need to remove it ourselves
const keyId = findKeyIdByName(contractState, keyName)
if (!keyId) {
keysToDelete.push(externalId)
return
} else if (keyId !== externalId) {
// Or, the key has been updated and we need to update it in the external
// contract as well
// Or, the key has been updated and we need to update it in the external
// contract as well
keysToUpdate.push(externalId)
}

Expand Down Expand Up @@ -1696,7 +1699,7 @@ export default (sbp('sbp/selectors/register', {
throw new Error(`[chelonia] Wrong contract ID. Expected ${contractID} but got ${message.contractID()}`)
}
if (!message.isFirstMessage() && (!has(state.contracts, contractID) || !has(state, contractID))) {
throw new Error('The event is not for a first message but the contract state is missing')
throw new ChelErrorUnrecoverable('The event is not for a first message but the contract state is missing')
}
preHandleEvent?.(message)
// the order the following actions are done is critically important!
Expand Down Expand Up @@ -1740,7 +1743,7 @@ export default (sbp('sbp/selectors/register', {
processingErrored = e?.name !== 'ChelErrorWarning'
this.config.hooks.processError?.(e, message, getMsgMeta(message, contractID, state))
// special error that prevents the head from being updated, effectively killing the contract
if (e.name === 'ChelErrorUnrecoverable') throw e
if (e.name === 'ChelErrorUnrecoverable' || message.isFirstMessage()) throw e
}

// process any side-effects (these must never result in any mutation to the contract state!)
Expand Down
Loading

0 comments on commit b19ce8e

Please sign in to comment.