Skip to content

Conversation

@akhil1508
Copy link
Contributor

  • I use the object-type that used to be there in NC 24 notifications markup to apply custom styles to notifications from certain apps
  • It is removed NC 25 onwards :(
  • The semantically correct way would be to make it a data-object-type attribute
  • Please consider re-adding it through this PR as it breaks some styles that I want applied

@nickvergessen
Copy link
Member

It is/was not removed, it should just be there in both ways now.
But I'm not really sure what you are trying to achieve. Can you link/share your code where you style it and why?

@akhil1508
Copy link
Contributor Author

akhil1508 commented Apr 5, 2023

It is/was not removed, it should just be there in both ways now.

@nickvergessen Prior to NC 25, the notification entry(div) used to look like:

<div data-v-7df7d6b8="" data-v-082f9351="" data-id="9181" data-timestamp="1680675908000" class="notification" notification_id="9181" object_type="previewgenerator" object_id="5.2.2">

After NC 25, it looks like:

<li data-v-7fd45550="" data-v-03956494="" data-id="672" data-timestamp="1680636752000" class="notification">
  • The object_type attr is missing after NC 25..

But I'm not really sure what you are trying to achieve. Can you link/share your code where you style it and why?

I am building an app with a simple occ command and a notifier to send notifications to all users via occ command(similar to the notification:generate command but to all users and with custom icons)

Since the object_type is the only way to identify that this notification is coming from my app and not some other one, I style it for e.g. like:

.notification[object_type="my-notifications-app"] {
  background-color: red;
}

But since it is gone in NC 25, my styles no longer apply :(

@nickvergessen
Copy link
Member

Ah, yeah so that was never intended to be part of the HTML body (since it's invalid). Exactly why the change was done.
Not sure I like styling being applied this way, but I guess it makes sense then

@nickvergessen
Copy link
Member

Let's also add data-app and then we can do this.

Can you run:

npm ci && npm run build

and also commit the resulting js/ changes? Then our CI will also be happy.

@akhil1508
Copy link
Contributor Author

Let's also add data-app and then we can do this.
Can you run:
npm ci && npm run build
and also commit the resulting js/ changes? Then our CI will also be happy.

@nickvergessen Done

Signed-off-by: Akhil <akhil@e.email>
@nickvergessen nickvergessen enabled auto-merge April 6, 2023 12:47
@nickvergessen nickvergessen merged commit 7776f46 into nextcloud:master Apr 6, 2023
@nickvergessen
Copy link
Member

/backport to stable26

@nickvergessen
Copy link
Member

/backport to stable25

@backportbot-nextcloud
Copy link

The backport to stable25 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable25
git pull origin/stable25

# Create the new backport branch
git checkout -b fix/foo-stable25

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable25

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants